本文整理匯總了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());
}
示例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()));
}
示例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);
}
}
示例4: getParent
/**
* {@inheritdoc}
*/
public function getParent()
{
return $this->node->getParent();
}
示例5: testGetParentRootnode
/**
* @expectedException \PHPCR\ItemNotFoundException
*/
public function testGetParentRootnode()
{
$this->rootNode->getParent();
}
示例6: getParent
/**
* @see \PHPCR\NodeInterface::getParent
*/
public function getParent()
{
return new Node($this->node->getParent());
}
示例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));
}