Service/CategoryService.php
private function buildTree($dataSet, $maxLevel = 0)
    {
        $tree = new \ArrayIterator();
        $references = new \ArrayIterator();

        /** @var DocumentIterator $dataSet */
        foreach ($dataSet as $node) {
            if ($node->isActive()) {
                $this->buildNode($node, $references, $tree, $maxLevel);
            }
        }

        $this->expandNodes($references);

        $this->sortChildTree($tree);

        return $tree;
    }
private function buildTree($dataSet, $maxLevel = 0)
    {
        $tree = new \ArrayIterator();
        $references = new \ArrayIterator();

        /** @var DocumentIterator $dataSet */
        foreach ($dataSet as $node) {
            if ($node->isActive()) {
                $this->buildNode($node, $references, $tree, $maxLevel);
            }
        }

        $this->expandNodes($references);

        $this->sortChildTree($tree);

        return $tree;
    }
private function buildTree ( $ dataSet , $ maxLevel = 0 ) { $ tree = new \ ArrayIterator ( ) ; $ references = new \ ArrayIterator ( ) ; /** @var DocumentIterator $dataSet */ foreach ( $ dataSet as $ node ) { if ( $ node -> isActive ( ) ) { $ this -> buildNode ( $ node , $ references , $ tree , $ maxLevel ) ; } } $ this -> expandNodes ( $ references ) ; $ this -> sortChildTree ( $ tree ) ; return $ tree ; }
Builds nested tree from single category list.

@param array $dataSet  A set of nodes.
@param int   $maxLevel Maximum levels deep of the tree to build.

@return array
Builds nested tree from single category list .