From 1fe1a6a048dd420d06704f72b296a463237d7603 Mon Sep 17 00:00:00 2001 From: Xesau Date: Mon, 1 Jul 2024 21:57:36 +0200 Subject: [PATCH] Fix incorrect exception message for ManyToOne attribute in embeddable class (#11536) When a ManyToOne attribute is encountered on an Embeddable class, the exception message reads "Attribute "Doctrine\ORM\Mapping\OneToMany" on embeddable [class] is not allowed.". This should be "Doctrine\ORM\Mapping\ManyToOne" on embeddable [class] is not allowed.". --- src/Mapping/Driver/AttributeDriver.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Mapping/Driver/AttributeDriver.php b/src/Mapping/Driver/AttributeDriver.php index 6fed1a24e67..9ba3481e3ba 100644 --- a/src/Mapping/Driver/AttributeDriver.php +++ b/src/Mapping/Driver/AttributeDriver.php @@ -390,7 +390,7 @@ public function loadMetadataForClass(string $className, PersistenceClassMetadata $metadata->mapOneToMany($mapping); } elseif ($manyToOneAttribute !== null) { if ($metadata->isEmbeddedClass) { - throw MappingException::invalidAttributeOnEmbeddable($metadata->name, Mapping\OneToMany::class); + throw MappingException::invalidAttributeOnEmbeddable($metadata->name, Mapping\ManyToOne::class); } $idAttribute = $this->reader->getPropertyAttribute($property, Mapping\Id::class);