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) {