From 38f06dabd30221d2a8d93851583ea9697c4a889a Mon Sep 17 00:00:00 2001 From: Soren Malling Date: Thu, 21 May 2026 15:02:24 +0200 Subject: [PATCH] TASK: Also read property names from annotations When collecting id properties for join columns also read properies annotated with the Id mapping from Doctrine ORM Resolves: #3558 --- .../Doctrine/Mapping/Driver/FlowAnnotationDriver.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php b/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php index ffcb349450..8d5a463b99 100644 --- a/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php +++ b/Neos.Flow/Classes/Persistence/Doctrine/Mapping/Driver/FlowAnnotationDriver.php @@ -522,11 +522,17 @@ protected function buildJoinColumnsIfNeeded(array $joinColumns, array $mapping, foreach ($joinColumns as &$joinColumn) { if ($joinColumn['referencedColumnName'] === null || $joinColumn['referencedColumnName'] === 'id') { if ($direction === self::MAPPING_REGULAR) { - $idProperties = $this->reflectionService->getPropertyNamesByTag($mapping['targetEntity'], 'id'); + $idProperties = array_unique(array_merge( + $this->reflectionService->getPropertyNamesByAnnotation($mapping['targetEntity'], ORM\Id::class), + $this->reflectionService->getPropertyNamesByTag($mapping['targetEntity'], 'id') + )); $joinColumnName = $this->buildJoinTableColumnName($mapping['targetEntity']); } else { $className = $this->getUnproxiedClassName($property->getDeclaringClass()->getName()); - $idProperties = $this->reflectionService->getPropertyNamesByTag($className, 'id'); + $idProperties = array_unique(array_merge( + $this->reflectionService->getPropertyNamesByAnnotation($mapping['targetEntity'], ORM\Id::class), + $this->reflectionService->getPropertyNamesByTag($mapping['targetEntity'], 'id') + )); $joinColumnName = $this->buildJoinTableColumnName($className); } if (count($idProperties) === 0) {