Skip to content

Commit 1fe1a6a

Browse files
authored
Fix incorrect exception message for ManyToOne attribute in embeddable class (doctrine#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.".
1 parent 722cea6 commit 1fe1a6a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Mapping/Driver/AttributeDriver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ public function loadMetadataForClass(string $className, PersistenceClassMetadata
390390
$metadata->mapOneToMany($mapping);
391391
} elseif ($manyToOneAttribute !== null) {
392392
if ($metadata->isEmbeddedClass) {
393-
throw MappingException::invalidAttributeOnEmbeddable($metadata->name, Mapping\OneToMany::class);
393+
throw MappingException::invalidAttributeOnEmbeddable($metadata->name, Mapping\ManyToOne::class);
394394
}
395395

396396
$idAttribute = $this->reader->getPropertyAttribute($property, Mapping\Id::class);

0 commit comments

Comments
 (0)