/**
  * Filter the query to restrict the result to roots of an object.
  * Same as ancestorsOf(), except that it includes the object passed as parameter in the result
  *
  * @param     Causadiferido $causadiferido The object to use for roots search
  *
  * @return    CausadiferidoQuery The current query, for fluid interface
  */
 public function rootsOf($causadiferido)
 {
     return $this->inTree($causadiferido->getScopeValue())->addUsingAlias(CausadiferidoPeer::LEFT_COL, $causadiferido->getLeftValue(), Criteria::LESS_EQUAL)->addUsingAlias(CausadiferidoPeer::RIGHT_COL, $causadiferido->getRightValue(), Criteria::GREATER_EQUAL);
 }
Example #2
0
 /**
  * Moves current node and its subtree to be the previous sibling of $sibling
  * The modifications in the current object and the tree are immediate
  *
  * @param      Causadiferido $sibling	Propel object for sibling node
  * @param      PropelPDO $con	Connection to use.
  *
  * @return     Causadiferido The current Propel object
  */
 public function moveToPrevSiblingOf($sibling, PropelPDO $con = null)
 {
     if (!$this->isInTree()) {
         throw new PropelException('A Causadiferido object must be already in the tree to be moved. Use the insertAsPrevSiblingOf() instead.');
     }
     if ($sibling->isRoot()) {
         throw new PropelException('Cannot move to previous sibling of a root node.');
     }
     if ($sibling->getScopeValue() != $this->getScopeValue()) {
         throw new PropelException('Moving nodes across trees is not supported');
     }
     if ($sibling->isDescendantOf($this)) {
         throw new PropelException('Cannot move a node as sibling of one of its subtree nodes.');
     }
     $this->moveSubtreeTo($sibling->getLeftValue(), $sibling->getLevel() - $this->getLevel(), $con);
     return $this;
 }