/** * 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(); }