From c19c4d4f534656e39bea54223ce83823e03a902d Mon Sep 17 00:00:00 2001 From: PaulZi Date: Thu, 17 Sep 2015 10:57:22 +0300 Subject: [PATCH] Single tree shift() fix --- NestedSetsBehavior.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/NestedSetsBehavior.php b/NestedSetsBehavior.php index da764a4..79e398f 100644 --- a/NestedSetsBehavior.php +++ b/NestedSetsBehavior.php @@ -617,7 +617,7 @@ class NestedSetsBehavior extends Behavior protected function shift($from, $to, $delta, $tree = null) { if ($delta !== 0 && ($to === null || $to >= $from)) { - if ($tree === null) { + if ($this->treeAttribute !== null && $tree === null) { $tree = $this->owner->getAttribute($this->treeAttribute); } foreach ([$this->leftAttribute, $this->rightAttribute] as $i => $attribute) { @@ -626,7 +626,7 @@ class NestedSetsBehavior extends Behavior [ 'and', $to === null ? ['>=', $attribute, $from] : ['between', $attribute, $from, $to], - [$this->treeAttribute => $tree], + $this->treeAttribute !== null ? [$this->treeAttribute => $tree] : [], ] ); }