Skip to content

Commit d7d79a2

Browse files
FormigTeenGromNaN
authored andcommitted
Check if $primaryKey is present before execute the unset
1 parent 2ea9f7a commit d7d79a2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Relations/EmbedsMany.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ public function dissociate($ids = [])
152152

153153
// Remove the document from the parent model.
154154
foreach ($records as $i => $record) {
155-
if (in_array($record[$primaryKey], $ids)) {
155+
if (array_key_exists($primaryKey, $record) && in_array($record[$primaryKey], $ids)) {
156156
unset($records[$i]);
157157
}
158158
}

0 commit comments

Comments
 (0)