当前位置: 首页>>代码示例>>PHP>>正文


PHP Object\ObjectManagerInterface类代码示例

本文整理汇总了PHP中TYPO3\Flow\Object\ObjectManagerInterface的典型用法代码示例。如果您正苦于以下问题:PHP ObjectManagerInterface类的具体用法?PHP ObjectManagerInterface怎么用?PHP ObjectManagerInterface使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ObjectManagerInterface类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setUp

 /**
  * 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);
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:11,代码来源:ParserTest.php

示例2: setUp

 /**
  * 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);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:11,代码来源:ParserTest.php

示例3: setUp

 /**
  * 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);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:13,代码来源:ParserTest.php

示例4: getAvailableJobConfigurations

 /**
  * 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;
 }
开发者ID:johannessteu,项目名称:JobButler,代码行数:16,代码来源:JobConfigurationRepository.php

示例5: convert

 /**
  * 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);
             }
     }
 }
开发者ID:skurfuerst,项目名称:PackageFactory.Guevara,代码行数:41,代码来源:NodePropertyConversionService.php

示例6: 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);
 }
开发者ID:flow2lab,项目名称:eventsourcing,代码行数:11,代码来源:ImmediateQueue.php

示例7: 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;
 }
开发者ID:econic,项目名称:testing,代码行数:40,代码来源:EntityFactory.php

示例8: render

    /**
     * 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;
    }
开发者ID:neos,项目名称:extjs,代码行数:53,代码来源:IncludeViewHelper.php

示例9: 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));
 }
开发者ID:kszyma,项目名称:flow-development-collection,代码行数:30,代码来源:ComponentChainFactory.php

示例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');
 }
开发者ID:sandstorm,项目名称:contentcomments,代码行数:12,代码来源:FeatureContext.php

示例11: 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']);
     }
 }
开发者ID:anihy,项目名称:Flowpack.SingleSignOn.Client,代码行数:13,代码来源:SignedRequestPattern.php

示例12: 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']);
 }
开发者ID:kdambekalns,项目名称:Flowpack.NodeGenerator,代码行数:12,代码来源:NodesGenerator.php

示例13: 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);
 }
开发者ID:kdambekalns,项目名称:setup,代码行数:14,代码来源:ConfigureRoutingComponent.php

示例14: 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));
     }
 }
开发者ID:johannessteu,项目名称:neos-development-collection,代码行数:12,代码来源:AssetValidator.php

示例15: 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;
 }
开发者ID:netlogix,项目名称:jsonapiorg,代码行数:40,代码来源:ResourceConverter.php


注:本文中的TYPO3\Flow\Object\ObjectManagerInterface类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。