Skip to content

Commit 1633ae5

Browse files
jakubdibalapionl
authored andcommitted
Prevent updating position column when is not dirty
1 parent 995d31f commit 1633ae5

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/PositionObserver.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,11 @@ public function saving($model)
4545
if ($model->isPositionUpdateDisabled() === false) {
4646
// Get the position for current and old value
4747
$position = $model->getPosition();
48+
49+
// Prevent modifying position column when updating and position columns has not changed
50+
if ($model->exists === true && $model->isDirty($model->getPositionColumn()) === false) {
51+
return;
52+
}
4853

4954
// Get the old position
5055
$oldPosition = $model->getOriginal($model->getPositionColumn());

0 commit comments

Comments
 (0)