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


PHP Service\NodeTypeManager类代码示例

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


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

示例1: setUp

 public function setUp()
 {
     $this->mockWorkspace = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace', array(), array(), '', FALSE);
     $this->mockNodeType = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeType', array(), array(), '', FALSE);
     $this->mockNodeTypeManager = $this->getMock('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager', array(), array(), '', FALSE);
     $this->mockNodeTypeManager->expects($this->any())->method('getNodeType')->will($this->returnValue($this->mockNodeType));
     $this->nodeData = $this->getAccessibleMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', array('dummy'), array('/foo/bar', $this->mockWorkspace));
     $this->nodeData->_set('nodeTypeManager', $this->mockNodeTypeManager);
     $this->nodeData->_set('nodeDataRepository', $this->getMock('TYPO3\\Flow\\Persistence\\RepositoryInterface'));
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:10,代码来源:NodeDataTest.php

示例2: setUp

 public function setUp()
 {
     $this->mockWorkspace = $this->getMockBuilder(Workspace::class)->disableOriginalConstructor()->getMock();
     $this->nodeData = $this->getAccessibleMock(NodeData::class, array('addOrUpdate'), array('/foo/bar', $this->mockWorkspace));
     $this->mockNodeType = $this->getMockBuilder(NodeType::class)->disableOriginalConstructor()->getMock();
     $this->mockNodeTypeManager = $this->getMockBuilder(NodeTypeManager::class)->disableOriginalConstructor()->getMock();
     $this->mockNodeTypeManager->expects($this->any())->method('getNodeType')->will($this->returnValue($this->mockNodeType));
     $this->mockNodeTypeManager->expects($this->any())->method('hasNodeType')->will($this->returnValue(true));
     $this->inject($this->nodeData, 'nodeTypeManager', $this->mockNodeTypeManager);
     $this->mockNodeDataRepository = $this->getMockBuilder(NodeDataRepository::class)->disableOriginalConstructor()->getMock();
     $this->inject($this->nodeData, 'nodeDataRepository', $this->mockNodeDataRepository);
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:12,代码来源:NodeDataTest.php

示例3: setUp

 public function setUp()
 {
     $this->mockWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
     $this->nodeData = $this->getAccessibleMock('TYPO3\\TYPO3CR\\Domain\\Model\\NodeData', array('addOrUpdate'), array('/foo/bar', $this->mockWorkspace));
     $this->mockNodeType = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\NodeType')->disableOriginalConstructor()->getMock();
     $this->mockNodeTypeManager = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager')->disableOriginalConstructor()->getMock();
     $this->mockNodeTypeManager->expects($this->any())->method('getNodeType')->will($this->returnValue($this->mockNodeType));
     $this->mockNodeTypeManager->expects($this->any())->method('hasNodeType')->will($this->returnValue(true));
     $this->inject($this->nodeData, 'nodeTypeManager', $this->mockNodeTypeManager);
     $this->mockNodeDataRepository = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository')->disableOriginalConstructor()->getMock();
     $this->inject($this->nodeData, 'nodeDataRepository', $this->mockNodeDataRepository);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:12,代码来源:NodeDataTest.php

示例4: repairCommand

 /**
  * Repair inconsistent nodes
  *
  * This command analyzes and repairs the node tree structure and individual nodes
  * based on the current node type configuration.
  *
  * The following checks will be performed:
  *
  * {pluginDescriptions}
  * <b>Examples:</b>
  *
  * ./flow node:repair
  *
  * ./flow node:repair --node-type TYPO3.Neos.NodeTypes:Page
  *
  * @param string $nodeType Node type name, if empty update all declared node types
  * @param string $workspace Workspace name, default is 'live'
  * @param boolean $dryRun Don't do anything, but report actions
  * @param boolean $cleanup If FALSE, cleanup tasks are skipped
  * @return void
  */
 public function repairCommand($nodeType = null, $workspace = 'live', $dryRun = false, $cleanup = true)
 {
     $this->pluginConfigurations = self::detectPlugins($this->objectManager);
     if ($this->workspaceRepository->countByName($workspace) === 0) {
         $this->outputLine('Workspace "%s" does not exist', array($workspace));
         exit(1);
     }
     if ($nodeType !== null) {
         if ($this->nodeTypeManager->hasNodeType($nodeType)) {
             $nodeType = $this->nodeTypeManager->getNodeType($nodeType);
         } else {
             $this->outputLine('Node type "%s" does not exist', array($nodeType));
             exit(1);
         }
     }
     if ($dryRun) {
         $this->outputLine('Dry run, not committing any changes.');
     }
     foreach ($this->pluginConfigurations as $pluginConfiguration) {
         /** @var NodeCommandControllerPluginInterface $plugin */
         $plugin = $pluginConfiguration['object'];
         $this->outputLine('<b>' . $plugin->getSubCommandShortDescription('repair') . '</b>');
         $this->outputLine();
         $plugin->invokeSubCommand('repair', $this->output, $nodeType, $workspace, $dryRun, $cleanup);
         $this->outputLine();
     }
     $this->outputLine('Node repair finished.');
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:49,代码来源:NodeCommandController.php

示例5: buildMappingInformation

 /**
  * Builds a Mapping Collection from the configured node types
  *
  * @param \Flowpack\ElasticSearch\Domain\Model\Index $index
  * @return \Flowpack\ElasticSearch\Mapping\MappingCollection<\Flowpack\ElasticSearch\Domain\Model\Mapping>
  */
 public function buildMappingInformation(Index $index)
 {
     $this->lastMappingErrors = new \TYPO3\Flow\Error\Result();
     $mappings = new MappingCollection(MappingCollection::TYPE_ENTITY);
     /** @var NodeType $nodeType */
     foreach ($this->nodeTypeManager->getNodeTypes() as $nodeTypeName => $nodeType) {
         if ($nodeTypeName === 'unstructured' || $nodeType->isAbstract()) {
             continue;
         }
         $type = $index->findType(self::convertNodeTypeNameToMappingName($nodeTypeName));
         $mapping = new Mapping($type);
         // http://www.elasticsearch.org/guide/en/elasticsearch/reference/current/mapping-root-object-type.html#_dynamic_templates
         // 'not_analyzed' is necessary
         $mapping->addDynamicTemplate('dimensions', array('path_match' => '__dimensionCombinations.*', 'match_mapping_type' => 'string', 'mapping' => array('type' => 'string', 'index' => 'not_analyzed')));
         foreach ($nodeType->getProperties() as $propertyName => $propertyConfiguration) {
             if (isset($propertyConfiguration['search']) && isset($propertyConfiguration['search']['elasticSearchMapping'])) {
                 if (is_array($propertyConfiguration['search']['elasticSearchMapping'])) {
                     $mapping->setPropertyByPath($propertyName, $propertyConfiguration['search']['elasticSearchMapping']);
                 }
             } elseif (isset($propertyConfiguration['type']) && isset($this->defaultConfigurationPerType[$propertyConfiguration['type']]['elasticSearchMapping'])) {
                 if (is_array($this->defaultConfigurationPerType[$propertyConfiguration['type']]['elasticSearchMapping'])) {
                     $mapping->setPropertyByPath($propertyName, $this->defaultConfigurationPerType[$propertyConfiguration['type']]['elasticSearchMapping']);
                 }
             } else {
                 $this->lastMappingErrors->addWarning(new \TYPO3\Flow\Error\Warning('Node Type "' . $nodeTypeName . '" - property "' . $propertyName . '": No ElasticSearch Mapping found.'));
             }
         }
         $mappings->add($mapping);
     }
     return $mappings;
 }
开发者ID:skurfuerst,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:37,代码来源:NodeTypeMappingBuilder.php

示例6: create

 /**
  * Helper method for creating a new node.
  *
  * @param NodeInterface $referenceNode
  * @param array $nodeData
  * @param string $position
  * @return NodeInterface
  * @throws \InvalidArgumentException
  */
 public function create(NodeInterface $referenceNode, array $nodeData, $position)
 {
     if (!in_array($position, array('before', 'into', 'after'), true)) {
         throw new \InvalidArgumentException('The position should be one of the following: "before", "into", "after".', 1347133640);
     }
     $nodeType = $this->nodeTypeManager->getNodeType($nodeData['nodeType']);
     if ($nodeType->isOfType('TYPO3.Neos:Document') && !isset($nodeData['properties']['uriPathSegment']) && isset($nodeData['properties']['title'])) {
         $nodeData['properties']['uriPathSegment'] = Utility::renderValidNodeName($nodeData['properties']['title']);
     }
     $proposedNodeName = isset($nodeData['nodeName']) ? $nodeData['nodeName'] : null;
     $nodeData['nodeName'] = $this->nodeService->generateUniqueNodeName($this->getDesignatedParentNode($referenceNode, $position)->getPath(), $proposedNodeName);
     if ($position === 'into') {
         $newNode = $referenceNode->createNode($nodeData['nodeName'], $nodeType);
     } else {
         $parentNode = $referenceNode->getParent();
         $newNode = $parentNode->createNode($nodeData['nodeName'], $nodeType);
         if ($position === 'before') {
             $newNode->moveBefore($referenceNode);
         } else {
             $newNode->moveAfter($referenceNode);
         }
     }
     if (isset($nodeData['properties']) && is_array($nodeData['properties'])) {
         foreach ($nodeData['properties'] as $propertyName => $propertyValue) {
             $newNode->setProperty($propertyName, $propertyValue);
         }
     }
     return $newNode;
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:38,代码来源:NodeOperations.php

示例7: searchForNodeAction

 /**
  * @param string $searchWord
  * @param Site $selectedSite
  * @return void
  */
 public function searchForNodeAction($searchWord, Site $selectedSite = NULL)
 {
     $documentNodeTypes = $this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Document');
     $shortcutNodeType = $this->nodeTypeManager->getNodeType('TYPO3.Neos:Shortcut');
     $nodeTypes = array_diff($documentNodeTypes, array($shortcutNodeType));
     $sites = array();
     $activeSites = $this->siteRepository->findOnline();
     foreach ($selectedSite ? array($selectedSite) : $activeSites as $site) {
         /** @var Site $site */
         $contextProperties = array('workspaceName' => 'live', 'currentSite' => $site);
         $contentDimensionPresets = $this->contentDimensionPresetSource->getAllPresets();
         if (count($contentDimensionPresets) > 0) {
             $mergedContentDimensions = array();
             foreach ($contentDimensionPresets as $contentDimensionIdentifier => $contentDimension) {
                 $mergedContentDimensions[$contentDimensionIdentifier] = array($contentDimension['default']);
                 foreach ($contentDimension['presets'] as $contentDimensionPreset) {
                     $mergedContentDimensions[$contentDimensionIdentifier] = array_merge($mergedContentDimensions[$contentDimensionIdentifier], $contentDimensionPreset['values']);
                 }
                 $mergedContentDimensions[$contentDimensionIdentifier] = array_values(array_unique($mergedContentDimensions[$contentDimensionIdentifier]));
             }
             $contextProperties['dimensions'] = $mergedContentDimensions;
         }
         /** @var ContentContext $liveContext */
         $liveContext = $this->contextFactory->create($contextProperties);
         $firstActiveDomain = $site->getFirstActiveDomain();
         $nodes = $this->nodeSearchService->findByProperties($searchWord, $nodeTypes, $liveContext, $liveContext->getCurrentSiteNode());
         if (count($nodes) > 0) {
             $sites[$site->getNodeName()] = array('site' => $site, 'domain' => $firstActiveDomain ? $firstActiveDomain->getHostPattern() : $this->request->getHttpRequest()->getUri()->getHost(), 'nodes' => $nodes);
         }
     }
     $this->view->assignMultiple(array('searchWord' => $searchWord, 'protocol' => $this->request->getHttpRequest()->getUri()->getScheme(), 'selectedSite' => $selectedSite, 'sites' => $sites, 'activeSites' => $activeSites));
 }
开发者ID:christophlehmann,项目名称:MOC.Varnish,代码行数:37,代码来源:VarnishCacheController.php

示例8: getNodeTypeNamesDeniedForCreation

 /**
  * Returns the node types that the currently authenticated user is *denied* to create within the given $referenceNode
  *
  * @param NodeInterface $referenceNode
  * @return string[] Array of granted node type names
  */
 public function getNodeTypeNamesDeniedForCreation(NodeInterface $referenceNode)
 {
     $privilegeSubject = new CreateNodePrivilegeSubject($referenceNode);
     $allNodeTypes = $this->nodeTypeManager->getNodeTypes();
     $deniedCreationNodeTypes = array();
     $grantedCreationNodeTypes = array();
     $abstainedCreationNodeTypes = array();
     foreach ($this->securityContext->getRoles() as $role) {
         /** @var CreateNodePrivilege $createNodePrivilege */
         foreach ($role->getPrivilegesByType(CreateNodePrivilege::class) as $createNodePrivilege) {
             if (!$createNodePrivilege->matchesSubject($privilegeSubject)) {
                 continue;
             }
             $affectedNodeTypes = $createNodePrivilege->getCreationNodeTypes() !== array() ? $createNodePrivilege->getCreationNodeTypes() : $allNodeTypes;
             if ($createNodePrivilege->isGranted()) {
                 $grantedCreationNodeTypes = array_merge($grantedCreationNodeTypes, $affectedNodeTypes);
             } elseif ($createNodePrivilege->isDenied()) {
                 $deniedCreationNodeTypes = array_merge($deniedCreationNodeTypes, $affectedNodeTypes);
             } else {
                 $abstainedCreationNodeTypes = array_merge($abstainedCreationNodeTypes, $affectedNodeTypes);
             }
         }
     }
     $implicitlyDeniedNodeTypes = array_diff($abstainedCreationNodeTypes, $grantedCreationNodeTypes);
     return array_merge($implicitlyDeniedNodeTypes, $deniedCreationNodeTypes);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:32,代码来源:AuthorizationService.php

示例9: generateVieSchema

 /**
  * Converts the nodes types to a fully structured array
  * in the same structure as the schema to be created.
  *
  * The schema also includes abstract node types for the full inheritance information in VIE.
  *
  * @return object
  */
 public function generateVieSchema()
 {
     if ($this->configuration !== null) {
         return $this->configuration;
     }
     $nodeTypes = $this->nodeTypeManager->getNodeTypes();
     foreach ($nodeTypes as $nodeTypeName => $nodeType) {
         $this->readNodeTypeConfiguration($nodeTypeName, $nodeType);
     }
     unset($this->types['typo3:unstructured']);
     foreach ($this->types as $nodeTypeName => $nodeTypeDefinition) {
         $this->types[$nodeTypeName]->subtypes = $this->getAllSubtypes($nodeTypeName);
         $this->types[$nodeTypeName]->ancestors = $this->getAllAncestors($nodeTypeName);
         $this->removeUndeclaredTypes($this->types[$nodeTypeName]->supertypes);
         $this->removeUndeclaredTypes($this->types[$nodeTypeName]->ancestors);
     }
     foreach ($this->properties as $property => $propertyConfiguration) {
         if (isset($propertyConfiguration->domains) && is_array($propertyConfiguration->domains)) {
             foreach ($propertyConfiguration->domains as $domain) {
                 if (preg_match('/TYPO3\\.Neos\\.NodeTypes:.*Column/', $domain)) {
                     $this->properties[$property]->ranges = array_keys($this->types);
                 }
             }
         }
     }
     // Convert the TYPO3.Neos:ContentCollection element to support content-collection
     // TODO Move to node type definition
     if (isset($this->types['typo3:TYPO3.Neos:ContentCollection'])) {
         $this->addProperty('typo3:TYPO3.Neos:ContentCollection', 'typo3:content-collection', array());
         $this->types['typo3:TYPO3.Neos:ContentCollection']->specific_properties[] = 'typo3:content-collection';
         $this->properties['typo3:content-collection']->ranges = array_keys($this->types);
     }
     $this->configuration = (object) array('types' => (object) $this->types, 'properties' => (object) $this->properties);
     return $this->configuration;
 }
开发者ID:robertlemke,项目名称:neos-development-collection,代码行数:43,代码来源:VieSchemaBuilder.php

示例10: labelForNodeType

 /**
  * Render the label for the given $nodeTypeName
  *
  * @param string $nodeTypeName
  * @throws \TYPO3\TYPO3CR\Exception\NodeTypeNotFoundException
  * @return string
  */
 public function labelForNodeType($nodeTypeName)
 {
     if (!$this->nodeTypeManager->hasNodeType($nodeTypeName)) {
         $explodedNodeTypeName = explode(':', $nodeTypeName);
         return end($explodedNodeTypeName);
     }
     $nodeType = $this->nodeTypeManager->getNodeType($nodeTypeName);
     return $nodeType->getLabel();
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:16,代码来源:RenderingHelper.php

示例11: setNodeType

 /**
  * Set the node type
  *
  * @param string $nodeType
  */
 public function setNodeType($nodeType)
 {
     if (is_string($nodeType)) {
         $nodeType = $this->nodeTypeManager->getNodeType($nodeType);
     }
     if (!$nodeType instanceof NodeType) {
         throw new \InvalidArgumentException('nodeType needs to be of type string or NodeType', 1452100970);
     }
     $this->nodeType = $nodeType;
 }
开发者ID:neos,项目名称:neos-ui,代码行数:15,代码来源:AbstractCreate.php

示例12: readNodeTypeConfigurationFillsTypeAndPropertyConfiguration

 /**
  * @test
  */
 public function readNodeTypeConfigurationFillsTypeAndPropertyConfiguration()
 {
     $this->assertEquals($this->vieSchemaBuilder->_get('superTypeConfiguration'), array());
     $this->assertEquals($this->vieSchemaBuilder->_get('types'), array());
     $this->assertEquals($this->vieSchemaBuilder->_get('properties'), array());
     $this->vieSchemaBuilder->_call('readNodeTypeConfiguration', 'TYPO3.Neos:TextWithImage', $this->nodeTypeManager->getNodeType('TYPO3.Neos:TextWithImage'));
     $this->assertEquals(array('typo3:TYPO3.Neos:TextWithImage' => array('typo3:TYPO3.Neos:Text')), $this->vieSchemaBuilder->_get('superTypeConfiguration'));
     $this->arrayHasKey('typo3:TYPO3.Neos:TextWithImage', $this->vieSchemaBuilder->_get('types'));
     $this->assertEquals(4, count($this->vieSchemaBuilder->_get('properties')));
 }
开发者ID:mgoldbeck,项目名称:neos-development-collection,代码行数:13,代码来源:VieSchemaBuilderTest.php

示例13: initializeObject

 /**
  * Called by the Flow object framework after creating the object and resolving all dependencies.
  *
  * @param integer $cause Creation cause
  */
 public function initializeObject($cause)
 {
     parent::initializeObject($cause);
     foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) {
         $searchSettingsForNodeType = $nodeType->getConfiguration('search');
         if (is_array($searchSettingsForNodeType) && isset($searchSettingsForNodeType['fulltext']['isRoot']) && $searchSettingsForNodeType['fulltext']['isRoot'] === TRUE) {
             $this->fulltextRootNodeTypes[] = $nodeType->getName();
         }
     }
 }
开发者ID:kuborgh-mspindelhirn,项目名称:Flowpack.SimpleSearch.ContentRepositoryAdaptor,代码行数:15,代码来源:NodeIndexer.php

示例14: matches

 /**
  * Returns TRUE if the given node is of the node type this filter expects.
  *
  * @param \TYPO3\TYPO3CR\Domain\Model\NodeInterface $node
  * @return boolean
  */
 public function matches(\TYPO3\TYPO3CR\Domain\Model\NodeInterface $node)
 {
     if ($this->withSubTypes === TRUE) {
         return $this->nodeTypeManager->getNodeType($node->getNodeType())->isOfType($this->nodeTypeName);
     } else {
         $nodeData = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($node, 'nodeData', TRUE);
         $nodeType = \TYPO3\Flow\Reflection\ObjectAccess::getProperty($nodeData, 'nodeType', TRUE);
         return $nodeType === $this->nodeTypeName;
     }
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:16,代码来源:NodeType.php

示例15: executeInternal

 /**
  * Executes this finisher
  * @see AbstractFinisher::execute()
  *
  * @return void
  * @throws \TYPO3\Form\Exception\FinisherException
  */
 protected function executeInternal()
 {
     $formValues = $this->finisherContext->getFormValues();
     $formNode = $this->formRegistry->getFormNode($this->finisherContext->getFormRuntime()->getIdentifier());
     $slug = uniqid('post');
     $postNode = $formNode->getParent()->createNode($slug, $this->nodeTypeManager->getNodeType('Lelesys.Plugin.ContactForm:FormPost'));
     foreach ($formValues as $propertyName => $value) {
         $postNode->setProperty($propertyName, $value);
     }
     $postNode->setProperty('postDateTime', time());
 }
开发者ID:desaisagar,项目名称:Lelesys.Plugin.ContactForm,代码行数:18,代码来源:PostValuesFinisher.php


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