Baum\Node::makeRoot PHP Method

makeRoot() public method

Make current node a root node.
public makeRoot ( ) : Node
return Node
    public function makeRoot()
    {
        return $this->moveTo($this, 'root');
    }

Usage Example

 /**
  * Make current page a root page, provided that a page
  * with the same scope does not exist.
  *
  * @return PageNode
  */
 public function makeRoot()
 {
     // guard agains root with the same scope
     $present = $this->newQuery()->where($this->getScopedConditions())->whereNull($this->getParentColumnName())->count() > 0;
     if ($present) {
         throw new \Baum\MoveNotPossibleException();
     }
     return parent::makeRoot();
 }