Skip to content

Commit d01850e

Browse files
author
Flaviu Chelaru
authored
Merge pull request #11 from P4BGroup/feat/fixes
hotfix/rebuild-tree
2 parents 4f46189 + 81690f7 commit d01850e

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/Behavior.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ public function processUpdate(ModelInterface $model): void
222222

223223
$right = $parentModel->readAttribute(self::$rightKey);
224224
$depth = $parentModel->readAttribute(self::$depthKey);
225-
if (
226-
$parentModel->readAttribute(self::$rightKey) > $currentModel->readAttribute(self::$rightKey)
225+
if ($currentModel->readAttribute(self::$rightKey) == 0) {
226+
$right = $parentModel->readAttribute(self::$rightKey);
227+
$depth = $parentModel->readAttribute(self::$depthKey) + 1;
228+
} elseif ($parentModel->readAttribute(self::$rightKey) > $currentModel->readAttribute(self::$rightKey)
227229
&& $parentModel->readAttribute(self::$rightKey) > $currentModel->readAttribute(self::$leftKey)
228230
) {
229231
$right = $parentModel->readAttribute(self::$rightKey) - 2;

0 commit comments

Comments
 (0)