public function getAncestors()
    {
        if($this->isRoot())
        {
            return array();
        }

        if($this->ancestors === null)
        {
            $qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
            $alias = $this->getManager()->getConfiguration()->getQueryBuilderAlias();

            $qb->andWhere("$alias.".$this->getLeftFieldName()." < :lft1")
                ->setParameter('lft1', $this->getLeftValue())
                ->andWhere("$alias.".$this->getRightFieldName()." > :rgt1")
                ->setParameter('rgt1', $this->getRightValue())
                ->orderBy("$alias.".$this->getLeftFieldName(), "ASC");
            if($this->hasManyRoots())
            {
                $qb->andWhere("$alias.".$this->getRootFieldName()." = :root")
                    ->setParameter('root', $this->getRootValue());
            }

			$q = $qb->getQuery();
			if ($this->getManager()->getConfiguration()->isQueryHintSet()){
				$q = $this->getManager()->addHintToQuery($q);
			}
			$results = $q->getResult();

            $this->ancestors = array();
            foreach($results as $result)
            {
                $this->ancestors[] = $this->getManager()->wrapNode($result);
            }
        }

        return $this->ancestors;
    }
public function getAncestors()
    {
        if($this->isRoot())
        {
            return array();
        }

        if($this->ancestors === null)
        {
            $qb = $this->getManager()->getConfiguration()->getBaseQueryBuilder();
            $alias = $this->getManager()->getConfiguration()->getQueryBuilderAlias();

            $qb->andWhere("$alias.".$this->getLeftFieldName()." < :lft1")
                ->setParameter('lft1', $this->getLeftValue())
                ->andWhere("$alias.".$this->getRightFieldName()." > :rgt1")
                ->setParameter('rgt1', $this->getRightValue())
                ->orderBy("$alias.".$this->getLeftFieldName(), "ASC");
            if($this->hasManyRoots())
            {
                $qb->andWhere("$alias.".$this->getRootFieldName()." = :root")
                    ->setParameter('root', $this->getRootValue());
            }

			$q = $qb->getQuery();
			if ($this->getManager()->getConfiguration()->isQueryHintSet()){
				$q = $this->getManager()->addHintToQuery($q);
			}
			$results = $q->getResult();

            $this->ancestors = array();
            foreach($results as $result)
            {
                $this->ancestors[] = $this->getManager()->wrapNode($result);
            }
        }

        return $this->ancestors;
    }
public function getAncestors ( ) { if ( $ this -> isRoot ( ) ) { return array ( ) ; } if ( $ this -> ancestors === null ) { $ qb = $ this -> getManager ( ) -> getConfiguration ( ) -> getBaseQueryBuilder ( ) ; $ alias = $ this -> getManager ( ) -> getConfiguration ( ) -> getQueryBuilderAlias ( ) ; $ qb -> andWhere ( "$alias." . $ this -> getLeftFieldName ( ) . " < :lft1" ) -> setParameter ( 'lft1' , $ this -> getLeftValue ( ) ) -> andWhere ( "$alias." . $ this -> getRightFieldName ( ) . " > :rgt1" ) -> setParameter ( 'rgt1' , $ this -> getRightValue ( ) ) -> orderBy ( "$alias." . $ this -> getLeftFieldName ( ) , "ASC" ) ; if ( $ this -> hasManyRoots ( ) ) { $ qb -> andWhere ( "$alias." . $ this -> getRootFieldName ( ) . " = :root" ) -> setParameter ( 'root' , $ this -> getRootValue ( ) ) ; } $ q = $ qb -> getQuery ( ) ; if ( $ this -> getManager ( ) -> getConfiguration ( ) -> isQueryHintSet ( ) ) { $ q = $ this -> getManager ( ) -> addHintToQuery ( $ q ) ; } $ results = $ q -> getResult ( ) ; $ this -> ancestors = array ( ) ; foreach ( $ results as $ result ) { $ this -> ancestors [ ] = $ this -> getManager ( ) -> wrapNode ( $ result ) ; } } return $ this -> ancestors ; }
gets ancestors for node

@return array array of NodeWrapper objects
gets ancestors for node