php TYPO3-Flow-Object-ObjectManagerInterface类(方法)实例源码

下面列出了php TYPO3-Flow-Object-ObjectManagerInterface 类(方法)源码代码实例,从而了解它的用法。

作者:johannesste    项目:neos-development-collectio   
/**
  * Sets up this test case
  *
  */
 protected function setUp()
 {
     $this->mockObjectManager = $this->createMock(ObjectManagerInterface::class);
     $this->mockObjectManager->expects($this->any())->method('isRegistered')->will($this->returnCallback(array($this, 'objectManagerIsRegisteredCallback')));
     $this->parser = $this->getAccessibleMock(Parser::class, array('dummy'));
     $this->parser->_set('objectManager', $this->mockObjectManager);
 }

作者:robertlemk    项目:neos-development-collectio   
/**
  * Sets up this test case
  *
  */
 protected function setUp()
 {
     $this->mockObjectManager = $this->createMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
     $this->mockObjectManager->expects($this->any())->method('isRegistered')->will($this->returnCallback(array($this, 'objectManagerIsRegisteredCallback')));
     $this->parser = $this->getAccessibleMock('TYPO3\\TypoScript\\Core\\Parser', array('dummy'));
     $this->parser->_set('objectManager', $this->mockObjectManager);
 }

作者:hlube    项目:neos-development-collectio   
/**
  * Sets up this test case
  *
  * @author  Robert Lemke <robert@typo3.org>
  */
 protected function setUp()
 {
     $this->mockObjectManager = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface', array(), array(), '', false);
     $this->mockObjectManager->expects($this->any())->method('isRegistered')->will($this->returnCallback(array($this, 'objectManagerIsRegisteredCallback')));
     $parserClassName = $this->buildAccessibleProxy('TYPO3\\TypoScript\\Core\\Parser');
     $this->parser = new $parserClassName();
     $this->parser->_set('objectManager', $this->mockObjectManager);
 }

作者:johannesste    项目:JobButle   
/**
  * Returns a map of all available jobs configuration
  *
  * @param ObjectManagerInterface $objectManager
  * @return array Array of available jobs configuration
  * @Flow\CompileStatic
  */
 public static function getAvailableJobConfigurations($objectManager)
 {
     $reflectionService = $objectManager->get('TYPO3\\Flow\\Reflection\\ReflectionService');
     $result = [];
     foreach ($reflectionService->getAllImplementationClassNamesForInterface(self::JOB_CONFIGURATION_INTERFACE) as $implementation) {
         $result[$implementation] = ['implementation' => $implementation];
     }
     return $result;
 }

作者:kaystrobac    项目:flo   
/**
  * 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');
     }
 }

作者:robertlemk    项目:neos-development-collectio   
/**
  * Prepare test objects
  */
 protected function setUp()
 {
     $this->nodeFactory = $this->getMockBuilder(NodeFactory::class)->setMethods(array('filterNodeByContext'))->getMock();
     $this->nodeFactory->expects(self::any())->method('filterNodeByContext')->willReturnArgument(0);
     $this->reflectionServiceMock = $this->createMock(ReflectionService::class);
     $this->reflectionServiceMock->expects(self::any())->method('getAllImplementationClassNamesForInterface')->with(NodeInterface::class)->willReturn(array(Node::class));
     $this->objectManagerMock = $this->createMock(ObjectManagerInterface::class);
     $this->objectManagerMock->expects(self::any())->method('get')->with(ReflectionService::class)->willReturn($this->reflectionServiceMock);
     $this->objectManagerMock->expects(self::any())->method('getClassNameByObjectName')->with(NodeInterface::class)->willReturn(Node::class);
     $this->inject($this->nodeFactory, 'objectManager', $this->objectManagerMock);
 }

作者:hlube    项目:neos-development-collectio   
/**
  * Prepare test objects
  */
 protected function setUp()
 {
     $this->nodeFactory = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Factory\\NodeFactory', array('filterNodeByContext'));
     $this->nodeFactory->expects(self::any())->method('filterNodeByContext')->willReturnArgument(0);
     $this->reflectionServiceMock = $this->getMock('TYPO3\\Flow\\Reflection\\ReflectionService');
     $this->reflectionServiceMock->expects(self::any())->method('getAllImplementationClassNamesForInterface')->with('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->willReturn(array('TYPO3\\TYPO3CR\\Domain\\Model\\Node'));
     $this->objectManagerMock = $this->getMock('TYPO3\\Flow\\Object\\ObjectManagerInterface');
     $this->objectManagerMock->expects(self::any())->method('get')->with('TYPO3\\Flow\\Reflection\\ReflectionService')->willReturn($this->reflectionServiceMock);
     $this->objectManagerMock->expects(self::any())->method('getClassNameByObjectName')->with('TYPO3\\TYPO3CR\\Domain\\Model\\NodeInterface')->willReturn('TYPO3\\TYPO3CR\\Domain\\Model\\Node');
     $this->inject($this->nodeFactory, 'objectManager', $this->objectManagerMock);
 }

作者:skurfuers    项目:PackageFactory.Guevar   
/**
  * Convert raw property values to the correct type according to a node type configuration
  *
  * @param NodeType $nodeType
  * @param string $propertyName
  * @param string $rawValue
  * @param Context $context
  * @return mixed
  */
 public function convert(NodeType $nodeType, $propertyName, $rawValue, Context $context)
 {
     $propertyType = $nodeType->getPropertyType($propertyName);
     switch ($propertyType) {
         case 'string':
             return $rawValue;
         case 'reference':
             return $this->convertReference($rawValue, $context);
         case 'references':
             return $this->convertReferences($rawValue, $context);
         case 'DateTime':
             return $this->convertDateTime($rawValue);
         case 'integer':
             return $this->convertInteger($rawValue);
         case 'boolean':
             return $this->convertBoolean($rawValue);
         case 'array':
             return $this->convertArray($rawValue);
         default:
             $innerType = $propertyType;
             if ($propertyType !== null) {
                 try {
                     $parsedType = \TYPO3\Flow\Utility\TypeHandling::parseType($propertyType);
                     $innerType = $parsedType['elementType'] ?: $parsedType['type'];
                 } catch (\TYPO3\Flow\Utility\Exception\InvalidTypeException $exception) {
                 }
             }
             if (is_string($rawValue) && $this->objectManager->isRegistered($innerType) && $rawValue !== '') {
                 return $this->propertyMapper->convert(json_decode($rawValue, true), $propertyType, $configuration);
             }
     }
 }

作者:flow2la    项目:eventsourcin   
/**
  * @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);
 }

作者:econi    项目:testin   
/**
  * 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;
 }

作者:neo    项目:extj   
/**
     * Returns the HTML needed to include ExtJS, that is, CSS and JS includes.
     *
     * = Examples =
     *
     * <code title="Simple">
     * {namespace ext=TYPO3\ExtJS\ViewHelpers}
     *  ...
     * <ext:include/>
     * </code>
     * Renders the script and link tags needed to include everything needed to
     * use ExtJS.
     *
     * <code title="Use a specific theme">
     * <ext:include theme="xtheme-gray"/>
     * </code>
     *
     * @param string $theme The theme to include, simply the name of the CSS
     * @param boolean $debug Whether to use the debug version of ExtJS
     * @param boolean $includeStylesheets Include ExtJS CSS files if true
     * @return string HTML needed to include ExtJS
     * @api
     */
    public function render($theme = 'xtheme-blue', $debug = NULL, $includeStylesheets = TRUE)
    {
        if ($debug === NULL) {
            $debug = $this->objectManager->getContext()->isDevelopment() ?: FALSE;
        }
        $baseUri = $this->resourcePublisher->getStaticResourcesWebBaseUri() . 'Packages/TYPO3.ExtJS/';
        $output = '';
        if ($includeStylesheets) {
            $output .= '
<link rel="stylesheet" href="' . $baseUri . 'CSS/ext-all-notheme.css" />
<link rel="stylesheet" href="' . $baseUri . 'CSS/' . $theme . '.css" />';
        }
        if ($debug) {
            $output .= '
<script type="text/javascript" src="' . $baseUri . 'JavaScript/adapter/ext/ext-base-debug.js"></script>
<script type="text/javascript" src="' . $baseUri . 'JavaScript/ext-all-debug.js"></script>';
        } else {
            $output .= '
<script type="text/javascript" src="' . $baseUri . 'JavaScript/adapter/ext/ext-base.js"></script>
<script type="text/javascript" src="' . $baseUri . 'JavaScript/ext-all.js"></script>';
        }
        $output .= '
<script type="text/javascript">
	Ext.BLANK_IMAGE_URL = \'' . $baseUri . 'images/default/s.gif\';
	Ext.FlashComponent.EXPRESS_INSTALL_URL = \'' . $baseUri . 'Flash/expressinstall.swf\';
	Ext.chart.Chart.CHART_URL = \'' . $baseUri . 'Flash/chart.swf\';
</script>
';
        return $output;
    }

作者:kszym    项目:flow-development-collectio   
/**
  * @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));
 }

作者:sandstor    项目:contentcomment   
/**
  * 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');
 }

作者:anih    项目:Flowpack.SingleSignOn.Clien   
/**
  * 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']);
     }
 }

作者:kdambekaln    项目:Flowpack.NodeGenerato   
/**
  * @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']);
 }

作者:kdambekaln    项目:setu   
/**
  * 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);
 }

作者:johannesste    项目:neos-development-collectio   
/**
  * 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));
     }
 }

作者:netlogi    项目:jsonapior   
/**
  * @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;
 }

作者:robertlemk    项目:neos-development-collectio   
/**
  * 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));
     }
 }

作者:yashodhan    项目:pane   
/**
  * 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');
 }


问题


面经


文章

微信
公众号

扫码关注公众号