public function delete() { if ($this->getId() == 1) { throw new \Exception("root-node cannot be deleted"); } parent::delete(); }