Skip to content

Commit 3fe4d12

Browse files
committed
fix: simplify root node insertion check in beforeInsertRootNode method.
1 parent e8d4c9b commit 3fe4d12

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

src/NestedSetsBehavior.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1070,10 +1070,7 @@ protected function beforeInsertNode(int $value, int $depth): void
10701070
*/
10711071
protected function beforeInsertRootNode(): void
10721072
{
1073-
if (
1074-
$this->treeAttribute === false &&
1075-
$this->getOwner()::find()->andWhere([$this->leftAttribute => 1])->exists()
1076-
) {
1073+
if ($this->treeAttribute === false && $this->getOwner()::find()->exists()) {
10771074
throw new Exception('Can not create more than one root when "treeAttribute" is false.');
10781075
}
10791076

0 commit comments

Comments
 (0)