public function getAncestors(AbstractNestedNode $node, $depth = null, $includeNode = false)
    {
        $q = $this->createQueryBuilder('n')
                ->andIsAncestorOf($node, !$includeNode);

        if (null !== $depth) {
            $q->andLevelIsUpperThan($node->getLevel() - $depth);
        }

        return $q->orderBy('n._rightnode', 'desc')
                        ->getQuery()
                        ->getResult();
    }
public function getAncestors(AbstractNestedNode $node, $depth = null, $includeNode = false)
    {
        $q = $this->createQueryBuilder('n')
                ->andIsAncestorOf($node, !$includeNode);

        if (null !== $depth) {
            $q->andLevelIsUpperThan($node->getLevel() - $depth);
        }

        return $q->orderBy('n._rightnode', 'desc')
                        ->getQuery()
                        ->getResult();
    }
public function getAncestors ( AbstractNestedNode $ node , $ depth = null , $ includeNode = false ) { $ q = $ this -> createQueryBuilder ( 'n' ) -> andIsAncestorOf ( $ node , ! $ includeNode ) ; if ( null !== $ depth ) { $ q -> andLevelIsUpperThan ( $ node -> getLevel ( ) - $ depth ) ; } return $ q -> orderBy ( 'n._rightnode' , 'desc' ) -> getQuery ( ) -> getResult ( ) ; }
Returns the ancestors of the provided node.

@param  \BackBee\NestedNode\AbstractNestedNode $node
@param  int                             $depth       Returns only ancestors from $depth number of generation
@param  boolean                         $includeNode Returns also the node itsef if TRUE
@return array
Returns the ancestors of the provided node .