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


PHP NodeDataRepository::findByParentAndNodeTypeRecursively方法代码示例

本文整理汇总了PHP中TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository::findByParentAndNodeTypeRecursively方法的典型用法代码示例。如果您正苦于以下问题:PHP NodeDataRepository::findByParentAndNodeTypeRecursively方法的具体用法?PHP NodeDataRepository::findByParentAndNodeTypeRecursively怎么用?PHP NodeDataRepository::findByParentAndNodeTypeRecursively使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TYPO3\TYPO3CR\Domain\Repository\NodeDataRepository的用法示例。


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

示例1: getNodes

 /**
  * Find all nodes of a specific node type
  *
  * @param string $nodeType
  * @param ContentContext $context current content context, see class doc comment for details
  * @return array<NodeInterface> all nodes of type $nodeType in the current $context
  */
 protected function getNodes($nodeType, ContentContext $context)
 {
     $nodes = array();
     $siteNode = $context->getCurrentSiteNode();
     foreach ($this->nodeDataRepository->findByParentAndNodeTypeRecursively($siteNode->getPath(), $nodeType, $context->getWorkspace()) as $nodeData) {
         $nodes[] = $this->nodeFactory->createFromNodeData($nodeData, $context);
     }
     return $nodes;
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:16,代码来源:PluginService.php

示例2: findByParentAndNodeTypeRecursivelyCallsGetNodeDataForParentAndNodeTypeWithRecursiveFlag

 /**
  * @test
  */
 public function findByParentAndNodeTypeRecursivelyCallsGetNodeDataForParentAndNodeTypeWithRecursiveFlag()
 {
     $parentPath = 'some/parent/path';
     $nodeTypeFilter = 'Some.Package:SomeNodeType';
     $mockWorkspace = $this->getMockBuilder('TYPO3\\TYPO3CR\\Domain\\Model\\Workspace')->disableOriginalConstructor()->getMock();
     $dimensions = array('persona' => array('everybody'), 'language' => array('de_DE', 'mul_ZZ'));
     $removedNodesFlag = TRUE;
     $recursiveFlag = TRUE;
     $this->nodeDataRepository->expects($this->once())->method('getNodeDataForParentAndNodeType')->with($parentPath, $nodeTypeFilter, $mockWorkspace, $dimensions, $removedNodesFlag, $recursiveFlag)->will($this->returnValue(array()));
     $this->nodeDataRepository->findByParentAndNodeTypeRecursively($parentPath, $nodeTypeFilter, $mockWorkspace, $dimensions, TRUE);
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:14,代码来源:NodeDataRepositoryTest.php

示例3: filterChildNodesForTreeAction

 /**
  * Return child nodes of specified node for usage in a TreeLoader based on filter
  *
  * @param Node $node The node to find child nodes for
  * @param string $term
  * @param string $nodeType
  * @return void
  */
 public function filterChildNodesForTreeAction(Node $node, $term, $nodeType)
 {
     $nodeTypes = strlen($nodeType) > 0 ? array($nodeType) : array_keys($this->nodeTypeManager->getSubNodeTypes('TYPO3.Neos:Document', false));
     $context = $node->getContext();
     if ($term !== '') {
         $nodes = $this->nodeSearchService->findByProperties($term, $nodeTypes, $context, $node);
     } else {
         $nodes = array();
         $nodeDataRecords = $this->nodeDataRepository->findByParentAndNodeTypeRecursively($node->getPath(), implode(',', $nodeTypes), $context->getWorkspace(), $context->getDimensions());
         foreach ($nodeDataRecords as $nodeData) {
             $matchedNode = $this->nodeFactory->createFromNodeData($nodeData, $context);
             if ($matchedNode !== null) {
                 $nodes[$matchedNode->getPath()] = $matchedNode;
             }
         }
     }
     $this->view->assignFilteredChildNodes($node, $nodes);
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:26,代码来源:NodeController.php

示例4: removeBrokenEntityReferences

 /**
  * Remove broken entity references
  *
  * This removes references from nodes to entities which don't exist anymore.
  *
  * @param string $workspaceName
  * @param boolean $dryRun
  * @return void
  */
 public function removeBrokenEntityReferences($workspaceName, $dryRun)
 {
     $this->output->outputLine('Checking for broken entity references ...');
     /** @var \TYPO3\TYPO3CR\Domain\Model\Workspace $workspace */
     $workspace = $this->workspaceRepository->findByIdentifier($workspaceName);
     $nodeTypesWithEntityReferences = array();
     foreach ($this->nodeTypeManager->getNodeTypes() as $nodeType) {
         /** @var NodeType $nodeType */
         foreach (array_keys($nodeType->getProperties()) as $propertyName) {
             $propertyType = $nodeType->getPropertyType($propertyName);
             if (strpos($propertyType, '\\') !== false) {
                 if (!isset($nodeTypesWithEntityReferences[$nodeType->getName()])) {
                     $nodeTypesWithEntityReferences[$nodeType->getName()] = array();
                 }
                 $nodeTypesWithEntityReferences[$nodeType->getName()][$propertyName] = $propertyType;
             }
         }
     }
     $nodesWithBrokenEntityReferences = array();
     $brokenReferencesCount = 0;
     foreach ($nodeTypesWithEntityReferences as $nodeTypeName => $properties) {
         $nodeDatas = $this->nodeDataRepository->findByParentAndNodeTypeRecursively('/', $nodeTypeName, $workspace);
         foreach ($nodeDatas as $nodeData) {
             /** @var NodeData $nodeData */
             foreach ($properties as $propertyName => $propertyType) {
                 $propertyValue = $nodeData->getProperty($propertyName);
                 $convertedProperty = null;
                 if (is_object($propertyValue)) {
                     $convertedProperty = $propertyValue;
                 }
                 if (is_string($propertyValue) && strlen($propertyValue) === 36) {
                     $convertedProperty = $this->propertyMapper->convert($propertyValue, $propertyType);
                     if ($convertedProperty === null) {
                         $nodesWithBrokenEntityReferences[$nodeData->getIdentifier()][$propertyName] = $nodeData;
                         $this->output->outputLine('Broken reference in "%s", property "%s" (%s) referring to %s.', array($nodeData->getPath(), $nodeData->getIdentifier(), $propertyName, $propertyType, $propertyValue));
                         $brokenReferencesCount++;
                     }
                 }
                 if ($convertedProperty instanceof \Doctrine\ORM\Proxy\Proxy) {
                     try {
                         $convertedProperty->__load();
                     } catch (EntityNotFoundException $e) {
                         $nodesWithBrokenEntityReferences[$nodeData->getIdentifier()][$propertyName] = $nodeData;
                         $this->output->outputLine('Broken reference in "%s", property "%s" (%s) referring to %s.', array($nodeData->getPath(), $nodeData->getIdentifier(), $propertyName, $propertyType, $propertyValue));
                         $brokenReferencesCount++;
                     }
                 }
             }
         }
     }
     if ($brokenReferencesCount > 0) {
         $this->output->outputLine();
         if (!$dryRun) {
             $self = $this;
             $this->askBeforeExecutingTask('Do you want to remove the broken entity references?', function () use($self, $nodesWithBrokenEntityReferences, $brokenReferencesCount, $workspaceName, $dryRun) {
                 foreach ($nodesWithBrokenEntityReferences as $nodeIdentifier => $properties) {
                     foreach ($properties as $propertyName => $nodeData) {
                         /** @var NodeData $nodeData */
                         $nodeData->setProperty($propertyName, null);
                     }
                 }
                 $self->output->outputLine('Removed %s broken entity reference%s.', array($brokenReferencesCount, $brokenReferencesCount > 1 ? 's' : ''));
             });
         } else {
             $this->output->outputLine('Found %s broken entity reference%s to be removed.', array($brokenReferencesCount, $brokenReferencesCount > 1 ? 's' : ''));
         }
         $this->output->outputLine();
     }
 }
开发者ID:simonschaufi,项目名称:neos-development-collection,代码行数:78,代码来源:NodeCommandControllerPlugin.php

示例5: listFormPostsAction

 /**
  * Returns the form post values
  *
  * @param string $path Absolute path of the node
  * @return void
  */
 public function listFormPostsAction($path)
 {
     $context = $this->contextFactory->create(array('workspaceName' => 'live'));
     $formNode = $this->nodeDataRepository->findOneByPath($path, $context->getWorkspace());
     $this->view->assignMultiple(array('formIdentifier' => $formNode->getProperty('formIdentifier'), 'formPosts' => $this->nodeDataRepository->findByParentAndNodeTypeRecursively($formNode->getParentPath(), 'Lelesys.Plugin.ContactForm:FormPost', $context->getWorkspace())));
 }
开发者ID:desaisagar,项目名称:Lelesys.Plugin.ContactForm,代码行数:12,代码来源:ContactListController.php


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