Sulu\Bundle\ContentBundle\Repository\NodeRepositoryInterface::getNodes PHP Метод

getNodes() публичный Метод

returns a list of nodes.
public getNodes ( string $parent, string $webspaceKey, string $languageCode, integer $depth = 1, boolean $flat = true, boolean $complete = true, boolean $excludeGhosts = false ) : array
$parent string uuid of parent node
$webspaceKey string key of current portal
$languageCode string
$depth integer
$flat boolean
$complete boolean
$excludeGhosts boolean
Результат array
    public function getNodes($parent, $webspaceKey, $languageCode, $depth = 1, $flat = true, $complete = true, $excludeGhosts = false);

Usage Example

Пример #1
0
 public function testOrderBeforeInExternalLink()
 {
     $data = $this->prepareOrderBeforeData();
     $newData = ['title' => 'Test4', 'external' => 'www.google.at', 'nodeType' => Structure::NODE_TYPE_EXTERNAL_LINK];
     $data[3] = $this->mapper->save($newData, 'external-link', 'sulu_io', 'en', 1, true, $data[3]->getUuid(), null, StructureInterface::STATE_PUBLISHED);
     $newData = ['title' => 'Test3', 'internal_link' => $data[0]->getUuid(), 'nodeType' => Structure::NODE_TYPE_INTERNAL_LINK];
     $data[2] = $this->mapper->save($newData, 'internal-link', 'sulu_io', 'en', 1, true, $data[2]->getUuid(), null, StructureInterface::STATE_PUBLISHED);
     $result = $this->nodeRepository->orderBefore($data[3]->getUuid(), $data[0]->getUuid(), 'sulu_io', 'en', 2);
     $this->assertEquals('Test4', $result['title']);
     $this->assertEquals('/test4', $result['path']);
     $this->assertEquals('www.google.at', $result['external']);
     //$this->assertEquals(2, $result['changer']);
     $result = $this->nodeRepository->orderBefore($data[2]->getUuid(), $data[3]->getUuid(), 'sulu_io', 'en', 2);
     $this->assertEquals('Test3', $result['title']);
     $this->assertEquals('/test3', $result['path']);
     $this->assertEquals($data[0]->getUuid(), $result['internal_link']);
     //$this->assertEquals(2, $result['changer']);
     $test = $this->nodeRepository->getNodes(null, 'sulu_io', 'en');
     $this->assertEquals(4, sizeof($test['_embedded']['nodes']));
     $nodes = $test['_embedded']['nodes'];
     $this->assertEquals('Test3', $nodes[0]['title']);
     $this->assertFalse($nodes[0]['hasSub']);
     $this->assertEquals('Test4', $nodes[1]['title']);
     $this->assertFalse($nodes[0]['hasSub']);
     $this->assertEquals('Test1', $nodes[2]['title']);
     $this->assertFalse($nodes[0]['hasSub']);
     $this->assertEquals('Test2', $nodes[3]['title']);
     $this->assertFalse($nodes[0]['hasSub']);
 }