DDC-752: Postpone Metadata Validation Until After Driver and loadClassMetadata Has Executed #928

Open
opened 2026-01-22 12:55:47 +01:00 by admin · 0 comments
Owner

Originally created by @doctrinebot on GitHub (Aug 17, 2010).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user mridgway:

Right now the metadata drivers throw exceptions if certain metadata is not specified. While this is convenient for letting the user know about errors, it limits the extensibility of the ORM, specifically what you can do in the loadClassMetadata event. It also means that there is duplicated code in each of the driver implementations for validation.

All validation of the metadata should be postponed until after the metadata driver has executed and also after the loadClassMetadata event has been fired. This way all metadata has been loaded before attempting to validate and the user is still warned about errors. This validation should still be ignored when loading from cache.

Example use case:

Currently, setting a @DiscriminatorMap is required when using inheritance mapping. The loadClassMetadata event provides a way to dynamically set discriminator maps from a config or a database without having to extend a metadata driver.

The specific regression in functionality that this references is MappingException::missingDiscriminatorMap being thrown in the metadata drivers.

Originally created by @doctrinebot on GitHub (Aug 17, 2010). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user mridgway: Right now the metadata drivers throw exceptions if certain metadata is not specified. While this is convenient for letting the user know about errors, it limits the extensibility of the ORM, specifically what you can do in the loadClassMetadata event. It also means that there is duplicated code in each of the driver implementations for validation. All validation of the metadata should be postponed until after the metadata driver has executed and also after the loadClassMetadata event has been fired. This way all metadata has been loaded before attempting to validate and the user is still warned about errors. This validation should still be ignored when loading from cache. Example use case: Currently, setting a @DiscriminatorMap is required when using inheritance mapping. The loadClassMetadata event provides a way to dynamically set discriminator maps from a config or a database without having to extend a metadata driver. The specific regression in functionality that this references is MappingException::missingDiscriminatorMap being thrown in the metadata drivers.
admin added the Improvement label 2026-01-22 12:55:47 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#928