diff --git a/src/NestedSetsBehavior.php b/src/NestedSetsBehavior.php index 211d7d9..3113d17 100644 --- a/src/NestedSetsBehavior.php +++ b/src/NestedSetsBehavior.php @@ -1070,10 +1070,7 @@ protected function beforeInsertNode(int $value, int $depth): void */ protected function beforeInsertRootNode(): void { - if ( - $this->treeAttribute === false && - $this->getOwner()::find()->andWhere([$this->leftAttribute => 1])->exists() - ) { + if ($this->treeAttribute === false && $this->getOwner()::find()->exists()) { throw new Exception('Can not create more than one root when "treeAttribute" is false.'); }