當前位置: 首頁>>代碼示例>>PHP>>正文


PHP NodeInterface::getParent方法代碼示例

本文整理匯總了PHP中PHPCR\NodeInterface::getParent方法的典型用法代碼示例。如果您正苦於以下問題:PHP NodeInterface::getParent方法的具體用法?PHP NodeInterface::getParent怎麽用?PHP NodeInterface::getParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PHPCR\NodeInterface的用法示例。


在下文中一共展示了NodeInterface::getParent方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: setUp

 protected function setUp()
 {
     parent::setUp();
     $this->contentMapper = $this->prophesize('Sulu\\Component\\Content\\Mapper\\ContentMapperInterface');
     $this->requestAnalyzer = $this->prophesize('Sulu\\Component\\Webspace\\Analyzer\\RequestAnalyzerInterface');
     $this->contentTypeManager = $this->prophesize('Sulu\\Component\\Content\\ContentTypeManagerInterface');
     $this->structureManager = $this->prophesize('Sulu\\Component\\Content\\Compat\\StructureManagerInterface');
     $this->sessionManager = $this->prophesize('Sulu\\Component\\PHPCR\\SessionManager\\SessionManagerInterface');
     $this->session = $this->prophesize('PHPCR\\SessionInterface');
     $this->node = $this->prophesize('PHPCR\\NodeInterface');
     $this->parentNode = $this->prophesize('PHPCR\\NodeInterface');
     $this->startPageNode = $this->prophesize('PHPCR\\NodeInterface');
     $webspace = new Webspace();
     $webspace->setKey('sulu_test');
     $locale = new Localization();
     $locale->setCountry('us');
     $locale->setLanguage('en');
     $this->requestAnalyzer->getWebspace()->willReturn($webspace);
     $this->requestAnalyzer->getCurrentLocalization()->willReturn($locale);
     $this->contentTypeManager->get('text_line')->willReturn(new TextLine(''));
     $this->sessionManager->getSession()->willReturn($this->session->reveal());
     $this->sessionManager->getContentNode('sulu_test')->willReturn($this->startPageNode->reveal());
     $this->session->getNodeByIdentifier('123-123-123')->willReturn($this->node->reveal());
     $this->session->getNodeByIdentifier('321-321-321')->willReturn($this->parentNode->reveal());
     $this->node->getIdentifier()->willReturn('123-123-123');
     $this->node->getParent()->willReturn($this->parentNode->reveal());
     $this->node->getDepth()->willReturn(4);
     $this->parentNode->getIdentifier()->willReturn('321-321-321');
     $this->parentNode->getDepth()->willReturn(3);
     $this->startPageNode->getDepth()->willReturn(3);
     $this->structureResolver = new StructureResolver($this->contentTypeManager->reveal(), $this->structureManager->reveal());
 }
開發者ID:Silwereth,項目名稱:sulu,代碼行數:32,代碼來源:ContentTwigExtensionTest.php

示例2: getSiblingNode

 /**
  * Return either the next or previous sibling of the given node
  * according to the $previous flag.
  *
  * @param NodeInterface $node
  * @param bool          $previous
  *
  * @return NodeInterface|null
  *
  * @throws \RuntimeException
  */
 private function getSiblingNode(NodeInterface $node, $previous = false)
 {
     $parentNode = $node->getParent();
     $children = $parentNode->getNodes();
     $previousNode = null;
     while ($child = current($children)) {
         if ($child->getPath() === $node->getPath()) {
             return $previous ? $previousNode : next($children);
         }
         $previousNode = $child;
         next($children);
     }
     throw new \RuntimeException(sprintf('Could not find node with path "%s" as a child of "%s". This should not happen', $node->getPath(), $parentNode->getPath()));
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:25,代碼來源:SuluNodeHelper.php

示例3: rename

 /**
  * TODO: This is a workaround for a bug in Jackalope which will be fixed in the next
  *       release 1.2: https://github.com/jackalope/jackalope/pull/262.
  */
 private function rename(NodeInterface $node, $name)
 {
     $names = (array) $node->getParent()->getNodeNames();
     $pos = array_search($node->getName(), $names);
     $next = isset($names[$pos + 1]) ? $names[$pos + 1] : null;
     $node->rename($name);
     if ($next) {
         $node->getParent()->orderBefore($name, $next);
     }
 }
開發者ID:hason,項目名稱:sulu-document-manager,代碼行數:14,代碼來源:AutoNameSubscriber.php

示例4: getParent

 /**
  * {@inheritdoc}
  */
 public function getParent()
 {
     return $this->node->getParent();
 }
開發者ID:sulu,項目名稱:sulu,代碼行數:7,代碼來源:SuluNode.php

示例5: testGetParentRootnode

 /**
  * @expectedException \PHPCR\ItemNotFoundException
  */
 public function testGetParentRootnode()
 {
     $this->rootNode->getParent();
 }
開發者ID:laurentiuc,項目名稱:phpcr-api-tests,代碼行數:7,代碼來源:NodeReadMethodsTest.php

示例6: getParent

 /**
  * @see \PHPCR\NodeInterface::getParent
  */
 public function getParent()
 {
     return new Node($this->node->getParent());
 }
開發者ID:marmelab,項目名稱:phpcr-api,代碼行數:7,代碼來源:Node.php

示例7: mapParent

 private function mapParent($document, NodeInterface $node)
 {
     // TODO: performance warning: We are eagerly fetching the parent node
     $targetNode = $node->getParent();
     // Do not map non-referenceable parent nodes
     if (!$targetNode->hasProperty('jcr:uuid')) {
         return;
     }
     $document->setParent($this->proxyFactory->createProxyForNode($document, $targetNode));
 }
開發者ID:hason,項目名稱:sulu-document-manager,代碼行數:10,代碼來源:ParentSubscriber.php


注:本文中的PHPCR\NodeInterface::getParent方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。