public function getAncestors($levelLimit = 0, $includeNode = false)
	{
		$left = $this->getLeftValue();
		$right = $this->getRightValue();
		$level = $this->getLevel();

		$searchCondition = $this->repository->createSearchCondition();
		
		// Will include the self node if required in the end
		$searchCondition->leftLessThan($left)
				->rightGreaterThan($right);

		if ($levelLimit < 0) {
			throw new Exception\Domain("Level limit cannot be negative in getAncestors method");
		} elseif ($levelLimit > 0) {
			$searchCondition->levelGreaterThanOrEqualsTo($level - $levelLimit);
		}

		$orderRule = $this->repository->createSelectOrderRule()
				->byLevelDescending();

		$ancestors = $this->repository->search($searchCondition, $orderRule);
		
		// Fixes not flushed node returning
		if ($includeNode) {
			if (isset($this->masterNode)) {
				array_unshift($ancestors, $this->masterNode);
			} else {
				array_unshift($ancestors, $this);
			}
		}
		
		return $ancestors;
	}
public function getAncestors($levelLimit = 0, $includeNode = false)
	{
		$left = $this->getLeftValue();
		$right = $this->getRightValue();
		$level = $this->getLevel();

		$searchCondition = $this->repository->createSearchCondition();
		
		// Will include the self node if required in the end
		$searchCondition->leftLessThan($left)
				->rightGreaterThan($right);

		if ($levelLimit < 0) {
			throw new Exception\Domain("Level limit cannot be negative in getAncestors method");
		} elseif ($levelLimit > 0) {
			$searchCondition->levelGreaterThanOrEqualsTo($level - $levelLimit);
		}

		$orderRule = $this->repository->createSelectOrderRule()
				->byLevelDescending();

		$ancestors = $this->repository->search($searchCondition, $orderRule);
		
		// Fixes not flushed node returning
		if ($includeNode) {
			if (isset($this->masterNode)) {
				array_unshift($ancestors, $this->masterNode);
			} else {
				array_unshift($ancestors, $this);
			}
		}
		
		return $ancestors;
	}
public function getAncestors ( $ levelLimit = 0 , $ includeNode = false ) { $ left = $ this -> getLeftValue ( ) ; $ right = $ this -> getRightValue ( ) ; $ level = $ this -> getLevel ( ) ; $ searchCondition = $ this -> repository -> createSearchCondition ( ) ; // Will include the self node if required in the end $ searchCondition -> leftLessThan ( $ left ) -> rightGreaterThan ( $ right ) ; if ( $ levelLimit < 0 ) { throw new Exception \ Domain ( "Level limit cannot be negative in getAncestors method" ) ; } elseif ( $ levelLimit > 0 ) { $ searchCondition -> levelGreaterThanOrEqualsTo ( $ level - $ levelLimit ) ; } $ orderRule = $ this -> repository -> createSelectOrderRule ( ) -> byLevelDescending ( ) ; $ ancestors = $ this -> repository -> search ( $ searchCondition , $ orderRule ) ; // Fixes not flushed node returning if ( $ includeNode ) { if ( isset ( $ this -> masterNode ) ) { array_unshift ( $ ancestors , $ this -> masterNode ) ; } else { array_unshift ( $ ancestors , $ this ) ; } } return $ ancestors ; }
Get array of ancestor nodes starting the deepest element
@param int $levelLimit
@param boolean $includeNode
@return array
@throws Exception\Domain
@nestedSetMethod
Get array of ancestor nodes starting the deepest element