當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。