code/database/behavior/recursable.php
public function getRecursiveIterator($max_level = 0, $parent = 0)
    {
        if($parent > 0 && !$this->__nodes->find($parent)) {
            throw new \OutOfBoundsException('Parent does not exist');
        }

        //If the parent doesn't have any children create an empty rowset
        if(isset($this->__children[$parent])) {
            $config = array('data' => $this->__children[$parent]);
        } else {
            $config = array();
        }

        $iterator = new DatabaseIteratorRecursive($this->getTable()->createRowset($config), $max_level);
        return $iterator;
    }
public function getRecursiveIterator($max_level = 0, $parent = 0)
    {
        if($parent > 0 && !$this->__nodes->find($parent)) {
            throw new \OutOfBoundsException('Parent does not exist');
        }

        //If the parent doesn't have any children create an empty rowset
        if(isset($this->__children[$parent])) {
            $config = array('data' => $this->__children[$parent]);
        } else {
            $config = array();
        }

        $iterator = new DatabaseIteratorRecursive($this->getTable()->createRowset($config), $max_level);
        return $iterator;
    }
public function getRecursiveIterator ( $ max_level = 0 , $ parent = 0 ) { if ( $ parent > 0 && ! $ this -> __nodes -> find ( $ parent ) ) { throw new \ OutOfBoundsException ( 'Parent does not exist' ) ; } //If the parent doesn't have any children create an empty rowset if ( isset ( $ this -> __children [ $ parent ] ) ) { $ config = array ( 'data' => $ this -> __children [ $ parent ] ) ; } else { $ config = array ( ) ; } $ iterator = new DatabaseIteratorRecursive ( $ this -> getTable ( ) -> createRowset ( $ config ) , $ max_level ) ; return $ iterator ; }
Get the recursive iterator

@param integer $max_level The maximum allowed level. 0 is used for any level
@param integer $parent    The key of the parent to start recursing from. 0 is used for the top level
@return DatabaseIteratorRecursive
@throws \OutOfBoundsException If a parent key is specified that doesn't exist.
Get the recursive iterator