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


PHP DocumentManager::getChildren方法代码示例

本文整理汇总了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));
     }
 }
开发者ID:steffenbrem,项目名称:phpcr-odm,代码行数:31,代码来源:DocumentManagerTest.php

示例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());
 }
开发者ID:steffenbrem,项目名称:phpcr-odm,代码行数:24,代码来源:ChildrenTest.php

示例3: getChildren

 /**
  * @inheritdoc
  * @param ChannelRoute $content
  */
 public function getChildren($content)
 {
     $children = $this->manager->getChildren($content->getChildrenRoot());
     return $children->toArray();
 }
开发者ID:JindrichPilar,项目名称:FeedBundle,代码行数:9,代码来源:MetaProvider.php


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