Skip to content

Commit

Permalink
fix makeRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
paulzi committed Aug 6, 2018
1 parent 8529d8e commit 2982502
Show file tree
Hide file tree
Showing 2 changed files with 242 additions and 210 deletions.
2 changes: 1 addition & 1 deletion NestedIntervalsBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,7 @@ public function beforeInsert()
switch ($this->operation) {
case self::OPERATION_MAKE_ROOT:
$condition = array_merge([$this->leftAttribute => $this->range[0]], $this->treeCondition());
if ($this->owner->findOne($condition) !== null) {
if ($this->owner->find()->andWhere($condition)->one() !== null) {
throw new Exception('Can not create more than one root.');
}
$this->owner->setAttribute($this->leftAttribute, $this->range[0]);
Expand Down

0 comments on commit 2982502

Please sign in to comment.