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 Jan 17, 2025
1 parent 87b71df commit c734838
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#
# It's auto-generated by sonata-project/dev-kit package.

.idea/
/build/
/node_modules/
/vendor/
Expand Down
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 c734838

Please sign in to comment.