Skip to content

Commit 43d8230

Browse files
committed
Fix position issue #1312
1 parent 943d69c commit 43d8230

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/orm/src/NestedSetMapper.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,11 @@ protected function preprocessSave(BeforeSaveEvent $event, bool $new = false): vo
335335

336336
if (is_array($event->source)) {
337337
$position = $event->source['position'];
338-
} else {
338+
} elseif ($event->source instanceof NestedEntityInterface) {
339339
$position = $event->source->getPosition();
340+
} else {
341+
// Here may be Collection or other object, keep position not change.
342+
$position = new Position();
340343
}
341344

342345
$this->hydrate(compact('position'), $entity);

0 commit comments

Comments
 (0)