/** * 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 ChildCategory $category The object to use for roots search * * @return $this|ChildCategoryQuery The current query, for fluid interface */ public function rootsOf(ChildCategory $category) { return $this->addUsingAlias(ChildCategory::LEFT_COL, $category->getLeftValue(), Criteria::LESS_EQUAL)->addUsingAlias(ChildCategory::RIGHT_COL, $category->getRightValue(), Criteria::GREATER_EQUAL); }
/** * Moves current node and its subtree to be the next sibling of $sibling * The modifications in the current object and the tree are immediate * * @param ChildCategory $sibling Propel object for sibling node * @param ConnectionInterface $con Connection to use. * * @return $this|ChildCategory The current Propel object */ public function moveToNextSiblingOf(ChildCategory $sibling, ConnectionInterface $con = null) { if (!$this->isInTree()) { throw new PropelException('A ChildCategory object must be already in the tree to be moved. Use the insertAsNextSiblingOf() instead.'); } if ($sibling->isRoot()) { throw new PropelException('Cannot move to next sibling of a root node.'); } if ($sibling->isDescendantOf($this)) { throw new PropelException('Cannot move a node as sibling of one of its subtree nodes.'); } $this->moveSubtreeTo($sibling->getRightValue() + 1, $sibling->getLevel() - $this->getLevel(), $con); return $this; }