Skip to content

Commit

Permalink
obtain reflection properties of ID columns by using provider method a…
Browse files Browse the repository at this point in the history
…lready available in ClassMetadata
  • Loading branch information
Vladimir Klimes committed Aug 23, 2024
1 parent e1072fc commit d7a5574
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AuditReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -1022,7 +1022,7 @@ private function createEntity($className, array $columnMap, array $data, $revisi
foreach (self::getRelationToSourceKeyColumns($assoc) as $sourceKeyJoinColumn => $sourceKeyColumn) {
$whereId[] = "{$sourceKeyJoinColumn} = ?";

$reflField = $classMetadata->reflFields[$classMetadata->getFieldName($sourceKeyColumn) ?? 'id'];
$reflField = $classMetadata->getSingleIdReflectionProperty();
\assert(null !== $reflField);

$values[] = $reflField->getValue($entity);
Expand Down Expand Up @@ -1110,7 +1110,7 @@ private function createEntity($className, array $columnMap, array $data, $revisi
)) {
foreach ($targetAssoc['relationToTargetKeyColumns'] as $targetKeyJoinColumn => $targetKeyColumn) {
$whereId[] = "{$targetKeyJoinColumn} = ?";
$reflField = $classMetadata->reflFields['id'];
$reflField = $classMetadata->getSingleIdReflectionProperty();
\assert(null !== $reflField);
$values[] = $reflField->getValue($entity);
}
Expand Down

0 comments on commit d7a5574

Please sign in to comment.