public function findRenderList( $id = null )
    {
        $platform = $this->getDbAdapter()
                         ->getPlatform();

        $columns = $this->getSelectColumns();
        $columns['_depth'] = new Sql\Expression( '(' .
            $this->sql( null )
                 ->select( array( 'parent' => static::$tableName ) )
                 ->columns( array(
                     new Sql\Expression( 'COUNT(*)' )
                 ) )
                 ->where( array(
                     new Sql\Predicate\Expression(
                         $platform->quoteIdentifierChain( array( static::$tableName, 'left' ) ) .
                         ' BETWEEN ' . $platform->quoteIdentifierChain( array( 'parent', 'left' ) ) .
                             ' AND ' . $platform->quoteIdentifierChain( array( 'parent', 'right' ) )
                     ),
                 ) )
                 ->getSqlString( $platform ) .
        ')' );

        $select = $this->select( $columns )
                       ->order( 'left' );

        if ( null !== $id )
        {
            $select->join( array( 'parent' => self::$tableName ),
                           '( ' . self::$tableName . '.left BETWEEN parent.left AND parent.right ) ',
                           array() )
                   ->where( array( 'parent.id' => $id ) );
        }

        /* @var $result \Zend\Db\Adapter\Driver\ResultInterface */

        $return = array();
        $result = $this->sql()
                       ->prepareStatementForSqlObject( $select )
                       ->execute();

        foreach ( $result as $row )
        {
            $depth = (int) $row['_depth'];
            unset( $row['_depth'] );
            $return[] = array( $depth, $this->selected( $row ) );
        }

        return $return;
    }
public function findRenderList( $id = null )
    {
        $platform = $this->getDbAdapter()
                         ->getPlatform();

        $columns = $this->getSelectColumns();
        $columns['_depth'] = new Sql\Expression( '(' .
            $this->sql( null )
                 ->select( array( 'parent' => static::$tableName ) )
                 ->columns( array(
                     new Sql\Expression( 'COUNT(*)' )
                 ) )
                 ->where( array(
                     new Sql\Predicate\Expression(
                         $platform->quoteIdentifierChain( array( static::$tableName, 'left' ) ) .
                         ' BETWEEN ' . $platform->quoteIdentifierChain( array( 'parent', 'left' ) ) .
                             ' AND ' . $platform->quoteIdentifierChain( array( 'parent', 'right' ) )
                     ),
                 ) )
                 ->getSqlString( $platform ) .
        ')' );

        $select = $this->select( $columns )
                       ->order( 'left' );

        if ( null !== $id )
        {
            $select->join( array( 'parent' => self::$tableName ),
                           '( ' . self::$tableName . '.left BETWEEN parent.left AND parent.right ) ',
                           array() )
                   ->where( array( 'parent.id' => $id ) );
        }

        /* @var $result \Zend\Db\Adapter\Driver\ResultInterface */

        $return = array();
        $result = $this->sql()
                       ->prepareStatementForSqlObject( $select )
                       ->execute();

        foreach ( $result as $row )
        {
            $depth = (int) $row['_depth'];
            unset( $row['_depth'] );
            $return[] = array( $depth, $this->selected( $row ) );
        }

        return $return;
    }
public function findRenderList ( $ id = null ) { $ platform = $ this -> getDbAdapter ( ) -> getPlatform ( ) ; $ columns = $ this -> getSelectColumns ( ) ; $ columns [ '_depth' ] = new Sql \ Expression ( '(' . $ this -> sql ( null ) -> select ( array ( 'parent' => static :: $ tableName ) ) -> columns ( array ( new Sql \ Expression ( 'COUNT(*)' ) ) ) -> where ( array ( new Sql \ Predicate \ Expression ( $ platform -> quoteIdentifierChain ( array ( static :: $ tableName , 'left' ) ) . ' BETWEEN ' . $ platform -> quoteIdentifierChain ( array ( 'parent' , 'left' ) ) . ' AND ' . $ platform -> quoteIdentifierChain ( array ( 'parent' , 'right' ) ) ) , ) ) -> getSqlString ( $ platform ) . ')' ) ; $ select = $ this -> select ( $ columns ) -> order ( 'left' ) ; if ( null !== $ id ) { $ select -> join ( array ( 'parent' => self :: $ tableName ) , '( ' . self :: $ tableName . '.left BETWEEN parent.left AND parent.right ) ' , array ( ) ) -> where ( array ( 'parent.id' => $ id ) ) ; } /* @var $result \Zend\Db\Adapter\Driver\ResultInterface */ $ return = array ( ) ; $ result = $ this -> sql ( ) -> prepareStatementForSqlObject ( $ select ) -> execute ( ) ; foreach ( $ result as $ row ) { $ depth = ( int ) $ row [ '_depth' ] ; unset ( $ row [ '_depth' ] ) ; $ return [ ] = array ( $ depth , $ this -> selected ( $ row ) ) ; } return $ return ; }
Find render-list

@param int|null $id
@return \Menu\Model\Menu\StructureInterface[]
Find render - list