本文整理汇总了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();
}