本文整理匯總了PHP中Doctrine\ODM\PHPCR\DocumentManager::getChildren方法的典型用法代碼示例。如果您正苦於以下問題:PHP DocumentManager::getChildren方法的具體用法?PHP DocumentManager::getChildren怎麽用?PHP DocumentManager::getChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Doctrine\ODM\PHPCR\DocumentManager
的用法示例。
在下文中一共展示了DocumentManager::getChildren方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testFindTranslationWithUntranslatedChildren
/**
* Test that children are retrieved in the parent locale
*/
public function testFindTranslationWithUntranslatedChildren()
{
$this->dm->persist($this->doc);
$this->dm->bindTranslation($this->doc, 'en');
$this->doc->topic = 'Un autre sujet';
$this->dm->bindTranslation($this->doc, 'fr');
$this->dm->flush();
$testNode = $this->node->getNode($this->testNodeName);
$testNode->addNode('new-comment');
$this->session->save();
$this->dm->clear();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'fr');
$this->assertEquals('fr', $this->doc->locale);
$children = $this->doc->getChildren();
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertInstanceOf('Doctrine\\ODM\\PHPCR\\Document\\Generic', $comment);
$this->assertNull($this->dm->getUnitOfWork()->getCurrentLocale($comment));
}
$this->dm->clear();
$this->doc = $this->dm->findTranslation($this->class, '/functional/' . $this->testNodeName, 'en');
$children = $this->dm->getChildren($this->doc);
$this->assertCount(1, $children);
foreach ($children as $comment) {
$this->assertInstanceOf('Doctrine\\ODM\\PHPCR\\Document\\Generic', $comment);
$this->assertNull($this->dm->getUnitOfWork()->getCurrentLocale($comment));
}
}
示例2: testChildrenCollection
public function testChildrenCollection()
{
$this->createChildren();
$parent = $this->dm->find($this->type, '/functional/parent');
$col = $this->dm->getChildren($parent);
$this->assertCount(4, $col);
$childA = $col['Child A'];
$this->assertEquals('Child A', $childA->name);
$this->assertEquals('Child A', $col->key());
$col = $this->dm->getChildren($parent, 'Child*');
$this->assertCount(4, $col);
$col = $this->dm->getChildren($parent, '*A');
$this->assertCount(1, $col);
$this->assertTrue($childA === $col->first());
$this->dm->clear();
$this->dm->find($this->type, '/functional/parent/Child D');
$parent = $this->dm->find($this->type, '/functional/parent');
$col = $this->dm->getChildren($parent);
$this->assertEquals('Child A', $col->key());
$this->dm->clear();
$this->dm->find($this->type, '/functional/parent/Child D');
$parent = $this->dm->find($this->type, '/functional/parent');
$this->assertEquals('Child A', $parent->allChildren->key());
}
示例3: getChildren
/**
* @inheritdoc
* @param ChannelRoute $content
*/
public function getChildren($content)
{
$children = $this->manager->getChildren($content->getChildrenRoot());
return $children->toArray();
}