/** * @param bool $forInsertNear * @throws Exception */ protected function checkNode($forInsertNear = false) { if ($forInsertNear && $this->node->isRoot()) { throw new Exception('Can not move a node before/after root.'); } if ($this->node->getIsNewRecord()) { throw new Exception('Can not move a node when the target node is new record.'); } if ($this->owner->equals($this->node)) { throw new Exception('Can not move a node when the target node is same.'); } if ($this->checkLoop && $this->node->isChildOf($this->owner)) { throw new Exception('Can not move a node when the target node is child.'); } }