Skip to content

Commit

Permalink
Fix incorrect exception message for ManyToOne attribute in embeddable…
Browse files Browse the repository at this point in the history
… 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.".
  • Loading branch information
Xesau authored Jul 1, 2024
1 parent 722cea6 commit 1fe1a6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Mapping/Driver/AttributeDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1fe1a6a

Please sign in to comment.