Skip to content

Commit

Permalink
Prevent ket casting for build eagerLoading Dictionary
Browse files Browse the repository at this point in the history
  • Loading branch information
florianJacques committed Jun 30, 2024
1 parent ed36b81 commit 070a611
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Relations/BelongsToMany.php
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,12 @@ protected function buildDictionary(Collection $results)

foreach ($results as $result) {
foreach ($result->$foreign as $item) {

//Prevent if id is non keyable
if ($item instanceof \MongoDB\BSON\ObjectId) {
$item = (string) $item;
}

$dictionary[$item][] = $result;
}
}
Expand Down

0 comments on commit 070a611

Please sign in to comment.