Skip to content

Commit 0dcc6d8

Browse files
committed
Check if $primaryKey is present before execute the unset
1 parent 0b03010 commit 0dcc6d8

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)