Skip to content

Commit ffb85e2

Browse files
committed
fix syncHasMany
1 parent 32c395e commit ffb85e2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ModelHandler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,13 +813,15 @@ public function validate(bool $validateOnlyPresent = false): void
813813
/**
814814
* Sync HasMany relation and return changes.
815815
* @param HasMany $rel
816-
* @param $ids
816+
* @param array|null $ids
817817
* @return array
818818
*/
819819
protected function syncHasMany(HasMany $rel, $ids): array
820820
{
821821
$res = ['attached' => [], 'detached' => []];
822-
if (!\is_array($ids) || empty($ids)) {
822+
if ($ids === null) {
823+
$ids = [];
824+
} elseif (!\is_array($ids)) {
823825
return $res;
824826
}
825827

0 commit comments

Comments
 (0)