本文整理汇总了PHP中TYPO3\Flow\Object\ObjectManagerInterface::get方法的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerInterface::get方法的具体用法?PHP ObjectManagerInterface::get怎么用?PHP ObjectManagerInterface::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\Flow\Object\ObjectManagerInterface
的用法示例。
在下文中一共展示了ObjectManagerInterface::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: queue
/**
* @param Message $message
* @return void
*/
public function queue(Message $message)
{
/** @var EventHandlerInterface $handler */
$handler = $this->objectManager->get($message->getRecipient());
$event = $this->arraySerializer->unserialize($message->getPayload());
$handler->handle($event);
}
示例2: __construct
/**
* Initializes the context
*
* @param array $parameters Context parameters (configured through behat.yml)
*/
public function __construct(array $parameters)
{
$this->useContext('flow', new \Flowpack\Behat\Tests\Behat\FlowContext($parameters));
$this->flowContext = $this->getSubcontext('flow');
$this->objectManager = $this->flowContext->getObjectManager();
$this->accountRepository = $this->objectManager->get('TYPO3\\Flow\\Security\\AccountRepository');
}
示例3: getNodeGeneratorImplementationClassByNodeType
/**
* @param NodeType $nodeType
* @return NodeGeneratorImplementationInterface
* @throws \TYPO3\Flow\Exception
*/
protected function getNodeGeneratorImplementationClassByNodeType(NodeType $nodeType)
{
if (!isset($this->generators[(string) $nodeType]['class'])) {
throw new Exception(sprintf('Unknown generator for the current Node Type (%s)', (string) $nodeType, 1391771111));
}
return $this->objectManager->get($this->generators[(string) $nodeType]['class']);
}
示例4: initializeObject
/**
* Adds all validators that extend the AssetValidatorInterface.
*
* @return void
*/
protected function initializeObject()
{
$assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface('TYPO3\\Media\\Domain\\Validator\\AssetValidatorInterface');
foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) {
$this->addValidator($this->objectManager->get($assetValidatorImplementationClassName));
}
}
示例5: setPattern
/**
* Sets the pattern (match) configuration
*
* @param object $patternConfiguration The pattern (match) configuration
* @return void
*/
public function setPattern($patternConfiguration)
{
$this->patternConfiguration = $patternConfiguration;
if (isset($patternConfiguration['resolverType'])) {
$this->publicKeyResolver = $this->objectManager->get($patternConfiguration['resolverType']);
}
}
示例6: create
/**
* @param array $chainConfiguration
* @return ComponentChain
* @throws Exception
*/
public function create(array $chainConfiguration)
{
if (empty($chainConfiguration)) {
return null;
}
$arraySorter = new PositionalArraySorter($chainConfiguration);
$sortedChainConfiguration = $arraySorter->toArray();
$chainComponents = array();
foreach ($sortedChainConfiguration as $componentName => $configuration) {
$componentOptions = isset($configuration['componentOptions']) ? $configuration['componentOptions'] : array();
if (isset($configuration['chain'])) {
$component = $this->create($configuration['chain']);
} else {
if (!isset($configuration['component'])) {
throw new Exception(sprintf('Component chain could not be created because no component class name is configured for component "%s"', $componentName), 1401718283);
}
$component = $this->objectManager->get($configuration['component'], $componentOptions);
if (!$component instanceof ComponentInterface) {
throw new Exception(sprintf('Component chain could not be created because the class "%s" does not implement the ComponentInterface, in component "%s" does not implement', $configuration['component'], $componentName), 1401718283);
}
}
$chainComponents[] = $component;
}
return new ComponentChain(array('components' => $chainComponents));
}
示例7: handle
/**
* Set the routes configuration for the Neos setup and configures the routing component
* to skip initialisation, which would overwrite the specific settings again.
*
* @param ComponentContext $componentContext
* @return void
*/
public function handle(ComponentContext $componentContext)
{
$configurationSource = $this->objectManager->get('TYPO3\\Flow\\Configuration\\Source\\YamlSource');
$routesConfiguration = $configurationSource->load($this->packageManager->getPackage('TYPO3.Setup')->getConfigurationPath() . ConfigurationManager::CONFIGURATION_TYPE_ROUTES);
$this->router->setRoutesConfiguration($routesConfiguration);
$componentContext->setParameter('TYPO3\\Flow\\Mvc\\Routing\\RoutingComponent', 'skipRouterInitialization', TRUE);
}
示例8: initializeObject
/**
* Adds all validators that extend the AssetValidatorInterface.
*
* @return void
*/
protected function initializeObject()
{
$assetValidatorImplementationClassNames = $this->reflectionService->getAllImplementationClassNamesForInterface(AssetValidatorInterface::class);
foreach ($assetValidatorImplementationClassNames as $assetValidatorImplementationClassName) {
$this->addValidator($this->objectManager->get($assetValidatorImplementationClassName));
}
}
示例9: convertFrom
/**
* @param mixed $source
* @param string $targetType
* @param array $convertedChildProperties
* @param PropertyMappingConfigurationInterface|null $configuration
* @return mixed|\Netlogix\JsonApiOrg\Schema\ResourceInterface|\TYPO3\Flow\Error\Error
*/
public function convertFrom($source, $targetType, array $convertedChildProperties = array(), PropertyMappingConfigurationInterface $configuration = null)
{
if (is_string($source)) {
$sourceArray = json_decode($source, true);
$source = is_array($sourceArray) ? $sourceArray : ['id' => $source];
}
if (!array_key_exists('type', $source)) {
$dummyPayload = $this->objectManager->get($targetType);
$typeIdentifier = $dummyPayload->getType();
$source['type'] = $this->exposableTypeMap->getType($typeIdentifier);
}
if (array_key_exists('id', $source)) {
$arguments = $source['id'];
} else {
$arguments = [];
}
$payload = $this->propertyMapper->convert($arguments, $this->exposableTypeMap->getClassName($source['type']));
$resourceInformation = $this->resourceMapper->findResourceInformation($payload);
$resource = $resourceInformation->getResource($payload);
if (isset($source['attributes'])) {
$attributes = $resource->getAttributes();
foreach ($source['attributes'] as $fieldName => $value) {
$attributes[$fieldName] = $value;
}
}
if (isset($source['relationships'])) {
$relationships = $resource->getRelationships();
foreach ($source['relationships'] as $fieldName => $value) {
$relationships[$fieldName] = $value;
}
}
return $resource;
}
示例10: __construct
/**
* Initializes the context
*
* @param array $parameters Context parameters (configured through behat.yml)
*/
public function __construct(array $parameters)
{
$this->useContext('flow', new \Flowpack\Behat\Tests\Behat\FlowContext($parameters));
$this->objectManager = $this->getSubcontext('flow')->getObjectManager();
$this->environment = $this->objectManager->get('TYPO3\\Flow\\Utility\\Environment');
$this->nodeAuthorizationService = $this->objectManager->get('TYPO3\\TYPO3CR\\Service\\AuthorizationService');
}
示例11: create
/**
* Mocks an entity as wished
*
* @param string $fqcn the fully qualified class name
* @param boolean $persist if the entity should be directly persisted or not
* @param array $customProperties the properties to set if wished
* @return Object
*/
public function create($fqcn, $persist = false, $customProperties = array())
{
$entityConfiguration = $this->entityConfiguration[$fqcn];
$this->validateEntityConfiguration($fqcn, $entityConfiguration);
// create from reflection class if constructor needs arguments
if (!empty($entityConfiguration['constructorArguments'])) {
$reflector = new \ReflectionClass($fqcn);
$constructorArguments = $this->getValuesFromConfigurations($entityConfiguration['constructorArguments']);
$entity = $reflector->newInstanceArgs($constructorArguments);
} else {
$entity = new $fqcn();
}
// set the properties
$configuredProperties = $entityConfiguration['properties'] ?: array();
$properties = array_merge($configuredProperties, $customProperties);
foreach ($this->getValuesFromConfigurations($properties, $persist) as $propertyName => $propertyValue) {
$propertyCouldBeSet = ObjectAccess::setProperty($entity, $propertyName, $propertyValue);
if (!$propertyCouldBeSet) {
throw new \Exception($fqcn . '::$' . $propertyName . ' could not be set to ' . print_r($propertyValue, true), 1416481470);
}
}
// persist if wished
if ($persist && is_string($entityConfiguration['repository'])) {
$this->objectManager->get($entityConfiguration['repository'])->add($entity);
// flush this entity here...
$this->entityManager->flush($entity);
// add to managed entities
$identifier = $this->persistenceManager->getIdentifierByObject($entity);
$this->managedEntities[$identifier] = $entity;
}
return $entity;
}
示例12: getTokenEndpointForProvider
/**
* @param string $providerName The provider name as given in Settings.yaml
* @throws \InvalidArgumentException
* @return TokenEndpointInterface
*/
public function getTokenEndpointForProvider($providerName)
{
$tokenEndpointClassName = $this->configurationManager->getConfiguration(ConfigurationManager::CONFIGURATION_TYPE_SETTINGS, sprintf('TYPO3.Flow.security.authentication.providers.%s.providerOptions.tokenEndpointClassName', $providerName));
if ($tokenEndpointClassName === NULL) {
throw new \InvalidArgumentException(sprintf('In Settings.yaml, there was no "tokenEndpointClassName" option given for the provider "%s".', $providerName), 1383743372);
}
return $this->objectManager->get($tokenEndpointClassName);
}
示例13: preToolbarRendering
/**
* TODO: Document this Method!
*/
public function preToolbarRendering()
{
$dispatcher = $this->objectManager->get('TYPO3\\Flow\\SignalSlot\\Dispatcher');
if (method_exists($dispatcher, 'getSignals')) {
$classes = $this->objectManager->get('TYPO3\\Flow\\SignalSlot\\Dispatcher')->getSignals();
$classes = $this->sanitize($classes);
\Debug\Toolbar\Service\Collector::getModule('Signals')->getToolbar()->addText('Signals')->addBadge(count($classes))->getPopup()->addPartial('Signals', array('classes' => $classes))->getPanel()->addPartial('Signals', array('classes' => $classes));
}
}
示例14: injectObjectManager
/**
* This object is created very early and is part of the blacklisted "TYPO3\Flow\Aop" namespace so we can't rely on AOP for the property injection.
*
* @param ObjectManagerInterface $objectManager
* @return void
*/
public function injectObjectManager(ObjectManagerInterface $objectManager)
{
if ($this->objectManager === null) {
$this->objectManager = $objectManager;
/** @var CacheManager $cacheManager */
$cacheManager = $this->objectManager->get(\TYPO3\Flow\Cache\CacheManager::class);
$this->runtimeExpressionsCache = $cacheManager->getCache('Flow_Aop_RuntimeExpressions');
$this->runtimeExpressions = $this->runtimeExpressionsCache->requireOnce('Flow_Aop_RuntimeExpressions');
}
}
示例15: create
/**
* @param string $annotatedTransformer Either a full qualified class name or a shortened one which is seeked in the current package.
*
* @throws \Flowpack\ElasticSearch\Exception
* @return \Flowpack\ElasticSearch\Indexer\Object\Transform\TransformerInterface
*/
public function create($annotatedTransformer)
{
if (!class_exists($annotatedTransformer)) {
$annotatedTransformer = 'Flowpack\\ElasticSearch\\Indexer\\Object\\Transform\\' . $annotatedTransformer . 'Transformer';
}
$transformer = $this->objectManager->get($annotatedTransformer);
if (!$transformer instanceof \Flowpack\ElasticSearch\Indexer\Object\Transform\TransformerInterface) {
throw new \Flowpack\ElasticSearch\Exception(sprintf('The transformer instance "%s" does not implement the TransformerInterface.', $annotatedTransformer), 1339598316);
}
return $transformer;
}