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


PHP Context::getRootNode方法代码示例

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


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

示例1: createNodeFromTemplateUsesIdentifierFromTemplate

 /**
  * @test
  */
 public function createNodeFromTemplateUsesIdentifierFromTemplate()
 {
     $identifier = \TYPO3\Flow\Utility\Algorithms::generateUUID();
     $template = new \TYPO3\TYPO3CR\Domain\Model\NodeTemplate();
     $template->setName('new-node');
     $template->setIdentifier($identifier);
     $rootNode = $this->context->getRootNode();
     $newNode = $rootNode->createNodeFromTemplate($template);
     $this->assertSame($identifier, $newNode->getIdentifier());
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:13,代码来源:NodeDataTest.php

示例2: nodePathAvailableForNodeWillReturnFalseIfNodeWithGivenPathExistsAlready

 /**
  * @test
  */
 public function nodePathAvailableForNodeWillReturnFalseIfNodeWithGivenPathExistsAlready()
 {
     $this->workspaceRepository->add(new \TYPO3\TYPO3CR\Domain\Model\Workspace('live'));
     $rootNode = $this->context->getRootNode();
     $fooNode = $rootNode->createNode('foo');
     $fooNode->createNode('bar');
     $bazNode = $rootNode->createNode('baz');
     $this->persistenceManager->persistAll();
     $actualResult = $this->nodeService->nodePathAvailableForNode('/foo/bar', $bazNode);
     $this->assertFalse($actualResult);
 }
开发者ID:hlubek,项目名称:neos-development-collection,代码行数:14,代码来源:NodeServiceTest.php

示例3: findNodesByRelatedEntitiesFindsExistingNodeWithMatchingEntityProperty

 /**
  * @test
  */
 public function findNodesByRelatedEntitiesFindsExistingNodeWithMatchingEntityProperty()
 {
     $rootNode = $this->context->getRootNode();
     $newNode = $rootNode->createNode('test', $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:NodeTypeWithEntities'));
     $testImage = new Image();
     $this->persistenceManager->add($testImage);
     $newNode->setProperty('image', $testImage);
     $this->persistenceManager->persistAll();
     $relationMap = array('TYPO3\\Flow\\Tests\\Functional\\Persistence\\Fixtures\\Image' => array($this->persistenceManager->getIdentifierByObject($testImage)));
     $result = $this->nodeDataRepository->findNodesByRelatedEntities($relationMap);
     $this->assertCount(1, $result);
 }
开发者ID:simonschaufi,项目名称:neos-development-collection,代码行数:15,代码来源:NodeDataRepositoryTest.php

示例4: setUp

 public function setUp()
 {
     parent::setUp();
     $this->workspaceRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\WorkspaceRepository');
     $liveWorkspace = new Workspace('live');
     $this->workspaceRepository->add($liveWorkspace);
     $this->nodeTypeManager = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\NodeTypeManager');
     $this->contextFactory = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Service\\ContextFactoryInterface');
     $this->context = $this->contextFactory->create(['workspaceName' => 'live', 'dimensions' => ['language' => ['en_US']], 'targetDimensions' => ['language' => 'en_US']]);
     $rootNode = $this->context->getRootNode();
     $this->siteNode = $rootNode->createNode('welcome', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $this->siteNode->setProperty('title', 'welcome');
     $this->nodeDataRepository = $this->objectManager->get('TYPO3\\TYPO3CR\\Domain\\Repository\\NodeDataRepository');
     $this->nodeIndexCommandController = $this->objectManager->get('Flowpack\\ElasticSearch\\ContentRepositoryAdaptor\\Command\\NodeIndexCommandController');
     $this->createNodesForNodeSearchTest();
 }
开发者ID:robertlemke,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:16,代码来源:ElasticSearchQueryTest.php

示例5: setUp

 public function setUp()
 {
     parent::setUp();
     $this->workspaceRepository = $this->objectManager->get(WorkspaceRepository::class);
     $liveWorkspace = new Workspace('live');
     $this->workspaceRepository->add($liveWorkspace);
     $this->nodeTypeManager = $this->objectManager->get(NodeTypeManager::class);
     $this->contextFactory = $this->objectManager->get(ContextFactoryInterface::class);
     $this->context = $this->contextFactory->create(['workspaceName' => 'live', 'dimensions' => ['language' => ['en_US']], 'targetDimensions' => ['language' => 'en_US']]);
     $rootNode = $this->context->getRootNode();
     $this->siteNode = $rootNode->createNode('welcome', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $this->siteNode->setProperty('title', 'welcome');
     $this->nodeDataRepository = $this->objectManager->get(NodeDataRepository::class);
     $this->nodeIndexCommandController = $this->objectManager->get(NodeIndexCommandController::class);
     $this->createNodesForNodeSearchTest();
 }
开发者ID:kdambekalns,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:16,代码来源:ElasticSearchQueryTest.php

示例6: getChildNodesWithNodeTypeFilterWorks

 /**
  * @test
  */
 public function getChildNodesWithNodeTypeFilterWorks()
 {
     $documentNodeType = $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:Document');
     $headlineNodeType = $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:Headline');
     $imageNodeType = $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:Image');
     $node = $this->context->getRootNode()->createNode('node-with-child-node', $documentNodeType);
     $node->createNode('headline', $headlineNodeType);
     $node->createNode('text', $imageNodeType);
     $this->assertCount(1, $node->getChildNodes('TYPO3.TYPO3CR.Testing:Headline'));
 }
开发者ID:futjikato,项目名称:neos-development-collection,代码行数:13,代码来源:NodesTest.php

示例7: createNodesForNodeSearchTest

 /**
  * @throws \TYPO3\TYPO3CR\Exception\NodeTypeNotFoundException
  */
 protected function createNodesForNodeSearchTest()
 {
     $rootNode = $this->context->getRootNode();
     $newNode1 = $rootNode->createNode('test-node-1', $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:NodeType'));
     $newNode1->setProperty('test1', 'simpleTestValue');
     $newNode2 = $rootNode->createNode('test-node-2', $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:NodeType'));
     $newNode2->setProperty('test2', 'simpleTestValue');
     $newNode2 = $rootNode->createNode('test-node-3', $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:NodeType'));
     $newNode2->setProperty('test1', 'otherValue');
     $this->persistenceManager->persistAll();
 }
开发者ID:hhoechtl,项目名称:neos-development-collection,代码行数:14,代码来源:NodeDataRepositoryTest.php

示例8: createNodesForNodeSearchTest

 /**
  * Creates some sample nodes to run tests against
  */
 protected function createNodesForNodeSearchTest()
 {
     $rootNode = $this->context->getRootNode();
     $newNode1 = $rootNode->createNode('test-node-1', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $newNode1->setProperty('title', 'chicken');
     $newNode2 = $rootNode->createNode('test-node-2', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $newNode2->setProperty('title', 'chicken');
     $newNode2 = $rootNode->createNode('test-node-3', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $newNode2->setProperty('title', 'egg');
     $this->persistenceManager->persistAll();
     $this->nodeIndexCommandController->buildCommand();
 }
开发者ID:johannessteu,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:15,代码来源:ElasticSearchQueryTest.php

示例9: nodesCanHaveCustomImplementationClass

 /**
  * @test
  */
 public function nodesCanHaveCustomImplementationClass()
 {
     $rootNode = $this->context->getRootNode();
     $testingNodeType = $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:NodeTypeWithReferences');
     $happyNodeType = $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:HappyTestingNode');
     $headlineNodeType = $this->nodeTypeManager->getNodeType('TYPO3.TYPO3CR.Testing:Headline');
     $fooNode = $rootNode->createNode('foo', $testingNodeType);
     $happyNode = $fooNode->createNode('bar', $happyNodeType);
     $bazNode = $happyNode->createNode('baz', $headlineNodeType);
     $this->assertNotInstanceOf('\\TYPO3\\TYPO3CR\\Tests\\Functional\\Domain\\Fixtures\\HappyNode', $fooNode);
     $this->assertInstanceOf('\\TYPO3\\TYPO3CR\\Tests\\Functional\\Domain\\Fixtures\\HappyNode', $happyNode);
     $this->assertNotInstanceOf('\\TYPO3\\TYPO3CR\\Tests\\Functional\\Domain\\Fixtures\\HappyNode', $bazNode);
     $this->assertEquals('bar claps hands!', $happyNode->clapsHands());
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:17,代码来源:NodesTest.php

示例10: repairCommand

 /**
  * Repair votes action
  *
  * Compare number of votes between nodes and vote log and repair, if not dryRun
  *
  * @param boolean $dryRun Don't do anything, but report actions
  * @return string
  */
 public function repairCommand($dryRun = TRUE)
 {
     if ($dryRun) {
         echo "Dry run, not making any changes\n";
     }
     $q = new FlowQuery(array($this->context->getRootNode()));
     $answerNodes = $q->find('[instanceof Sfi.Encult:Answer]')->get();
     foreach ($answerNodes as $answerNode) {
         /** @var \Doctrine\ORM\QueryBuilder $queryBuilder */
         $queryBuilder = $this->entityManager->createQueryBuilder();
         $nodes = $queryBuilder->select('v')->from('Sfi\\Encult\\Domain\\Model\\Vote', 'v')->andWhere('v.answerIdentifier = :answerIdentifier')->setParameters(array('answerIdentifier' => $answerNode->getIdentifier()))->getQuery()->getArrayResult();
         $dbCount = count($nodes);
         $crCount = $answerNode->getProperty('voteCount');
         $path = $answerNode->getPath();
         if ($dbCount !== $crCount) {
             echo "Found mistake for {$path} (db: {$dbCount} vs. cr: {$crCount})\n";
             if (!$dryRun) {
                 echo "Fixed\n";
                 $answerNode->setProperty('voteCount', $dbCount);
             }
         }
     }
     return "Done!\n";
 }
开发者ID:alexkuklin,项目名称:EncultDistr,代码行数:32,代码来源:VoteCommandController.php

示例11: createNodesForNodeSearchTest

 /**
  * Creates some sample nodes to run tests against
  */
 protected function createNodesForNodeSearchTest()
 {
     $rootNode = $this->context->getRootNode();
     $newNode1 = $rootNode->createNode('test-node-1', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $newNode1->setProperty('title', 'chicken');
     $newNode2 = $rootNode->createNode('test-node-2', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $newNode2->setProperty('title', 'chicken');
     $newNode3 = $rootNode->createNode('test-node-3', $this->nodeTypeManager->getNodeType('TYPO3.Neos.NodeTypes:Page'));
     $newNode3->setProperty('title', 'egg');
     $dimensionContext = $this->contextFactory->create(array('workspaceName' => 'live', 'dimensions' => array('language' => array('de'))));
     $translatedNode3 = $dimensionContext->adoptNode($newNode3, TRUE);
     $translatedNode3->setProperty('title', 'Ei');
     $this->persistenceManager->persistAll();
     $this->nodeIndexCommandController->buildCommand();
 }
开发者ID:hphoeksma,项目名称:Flowpack.ElasticSearch.ContentRepositoryAdaptor,代码行数:18,代码来源:ElasticSearchQueryTest.php

示例12: nodeDataRepositoryRenumbersNodesIfNoFreeSortingIndexesAreAvailable

 /**
  * @test
  */
 public function nodeDataRepositoryRenumbersNodesIfNoFreeSortingIndexesAreAvailable()
 {
     $rootNode = $this->context->getRootNode();
     $liveParentNode = $rootNode->createNode('parentNode');
     $nodes = array();
     $nodes[0] = $liveParentNode->createNode('node000');
     $nodes[150] = $liveParentNode->createNode('node150');
     $this->persistenceManager->persistAll();
     for ($i = 1; $i < 150; $i++) {
         $nodes[$i] = $liveParentNode->createNode('node' . sprintf('%1$03d', $i));
         $nodes[$i]->moveAfter($nodes[$i - 1]);
     }
     $this->persistenceManager->persistAll();
     ksort($nodes);
     $actualChildNodes = $liveParentNode->getChildNodes();
     $this->assertSameOrder($nodes, $actualChildNodes);
 }
开发者ID:radmiraal,项目名称:TYPO3.TYPO3CR,代码行数:20,代码来源:NodesTest.php

示例13: nodeWithRelatedEntitiesWillTakeCareOfAddingToPersistence

 /**
  * @test
  */
 public function nodeWithRelatedEntitiesWillTakeCareOfAddingToPersistence()
 {
     $identifier = Algorithms::generateUUID();
     $template = new NodeTemplate();
     $template->setName('new-node');
     $template->setIdentifier($identifier);
     $newEntity = new Fixtures\RelatedEntity();
     $newEntity->setFavoritePlace('Reykjavik');
     $anotherNewEntity = new Fixtures\RelatedEntity();
     $anotherNewEntity->setFavoritePlace('Japan');
     $template->setProperty('entity', array($newEntity, $anotherNewEntity));
     $rootNode = $this->context->getRootNode();
     $newNode = $rootNode->createNodeFromTemplate($template);
     $this->persistenceManager->persistAll();
     $this->persistenceManager->clearState();
     $this->inject($this->contextFactory, 'contextInstances', array());
     $newLiveContext = $this->contextFactory->create(array('workspaceName' => 'live'));
     $newNodeAgain = $newLiveContext->getNode('/new-node');
     $entityArray = $newNodeAgain->getProperty('entity');
     $this->assertCount(2, $entityArray);
     $this->assertEquals('Japan', $entityArray[1]->getFavoritePlace());
 }
开发者ID:radmiraal,项目名称:neos-development-collection,代码行数:25,代码来源:NodeDataTest.php

示例14: getNewsByOriginalId

 protected function getNewsByOriginalId($id)
 {
     $q = new FlowQuery(array($this->context->getRootNode()));
     return $q->find('[instanceof Sfi.Kateheo:News]')->filter('[originalIdentifier = "' . $id . '"]')->get(0);
 }
开发者ID:psmb,项目名称:KateheoDistr,代码行数:5,代码来源:MigrationCommandController.php


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