No way to rely on fallback in onClassMetadataNotFound #7298

Open
opened 2026-01-22 15:49:30 +01:00 by admin · 1 comment
Owner

Originally created by @hlib-kuznetsov on GitHub (Jan 18, 2024).

Bug Report

Q A
BC Break no idea
Version 2.17.3

Summary

To make possible providing missing metadata in onClassMetadataNotFound (which I belive is the main purpose of this event)
Doctrine\Persistence\Mapping\MappingException should be thrown if driver is not able to load metadata for entity.
https://github.com/doctrine/persistence/blob/3.2.x/src/Persistence/Mapping/AbstractClassMetadataFactory.php#L227-L228

But AttributeDriver throws Doctrine\ORM\Mapping\MappingException who is not ancestor of Doctrine\Persistence\Mapping\MappingException, so it seems currenly onClassMetadataNotFound is pointless
https://github.com/doctrine/orm/blob/2.17.x/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php#L160

Originally created by @hlib-kuznetsov on GitHub (Jan 18, 2024). ### Bug Report <!-- Fill in the relevant information below to help triage your issue. --> | Q | A |------------ | ------ | BC Break | no idea | Version | 2.17.3 #### Summary To make possible providing missing metadata in `onClassMetadataNotFound` (which I belive is the main purpose of this event) `Doctrine\Persistence\Mapping\MappingException` should be thrown if driver is not able to load metadata for entity. https://github.com/doctrine/persistence/blob/3.2.x/src/Persistence/Mapping/AbstractClassMetadataFactory.php#L227-L228 But AttributeDriver throws `Doctrine\ORM\Mapping\MappingException` who is not ancestor of `Doctrine\Persistence\Mapping\MappingException`, so it seems currenly `onClassMetadataNotFound` is pointless https://github.com/doctrine/orm/blob/2.17.x/lib/Doctrine/ORM/Mapping/Driver/AttributeDriver.php#L160
Author
Owner

@greg0ire commented on GitHub (Jan 18, 2024):

I think this will be fixed in 3.0: https://github.com/doctrine/orm/pull/7199

@greg0ire commented on GitHub (Jan 18, 2024): I think this will be fixed in 3.0: https://github.com/doctrine/orm/pull/7199
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#7298