From d7a557402becda1a5b2b121151a491d80933ef0c Mon Sep 17 00:00:00 2001 From: Vladimir Klimes Date: Fri, 23 Aug 2024 11:53:26 +0200 Subject: [PATCH] obtain reflection properties of ID columns by using provider method already available in ClassMetadata --- src/AuditReader.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AuditReader.php b/src/AuditReader.php index 86eeacf1..8dd8f63c 100644 --- a/src/AuditReader.php +++ b/src/AuditReader.php @@ -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); @@ -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); }