Skip to content

Commit

Permalink
convert objects to arrays in order to maintain backwards compat with …
Browse files Browse the repository at this point in the history
…existing process.
  • Loading branch information
stopfstedt committed Mar 27, 2024
1 parent 2ef52aa commit 0a43340
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Traits/ManagerRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,17 @@ protected function attachRelatedToDtos(
return $dtos;
}
$ids = array_keys($dtos);
// KLUDGE!
// Doctrine 3.x changes the internal data structure from nested assoc arrays to an all-object representation.
// Here, we convert the mapping objects into arrays,
// so we don't have to rewrite this entire process at this point.
// @todo Refactor this to use the objects that Doctrine gives us now [ST 2024/02/27]
$maps = array_map(
fn (object $obj) => $obj->toArray(),
$this->getClassMetadata()->associationMappings
);
$relatedMetadata = array_filter(
$this->getClassMetadata()->associationMappings,
$maps,
fn (array $arr) => array_key_exists('joinTable', $arr) && in_array($arr['fieldName'], $related)
);
$owningSideSets = $this->extractSetsFromOwningSideMetadata(
Expand Down

0 comments on commit 0a43340

Please sign in to comment.