DDC-355: [Patch] Throw exception if class in DiscriminatorMap is unknown #441

Closed
opened 2026-01-22 12:38:18 +01:00 by admin · 5 comments
Owner

Originally created by @doctrinebot on GitHub (Feb 20, 2010).

Jira issue originally created by user shurakai:

Prevent Doctrine from triggering a "PHP Warning" in ClassMetaDataInfo if a class used within a discriminator map could not be loaded. Instead, throw an exception stating which class could not be found and where its used.

Originally created by @doctrinebot on GitHub (Feb 20, 2010). Jira issue originally created by user shurakai: Prevent Doctrine from triggering a "PHP Warning" in ClassMetaDataInfo if a class used within a discriminator map could not be loaded. Instead, throw an exception stating which class could not be found and where its used.
admin added the Improvement label 2026-01-22 12:38:18 +01:00
admin closed this issue 2026-01-22 12:38:19 +01:00
Author
Owner

@doctrinebot commented on GitHub (Feb 23, 2010):

Comment created by romanb:

That would mean that *all* classes of a hierarchy are loaded whenever 1 is needed. Not sure thats a good idea. Maybe we can address that differently. Where is the php warning triggered exactly?

@doctrinebot commented on GitHub (Feb 23, 2010): Comment created by romanb: That would mean that **all\* classes of a hierarchy are loaded whenever *1** is needed. Not sure thats a good idea. Maybe we can address that differently. Where is the php warning triggered exactly?
Author
Owner

@doctrinebot commented on GitHub (Feb 23, 2010):

Comment created by shurakai:

Roman, this is already performed by calling is_subclass_of in ClassMetadataInfo, line 1437 (in setDiscriminatorMap() ). However, if there is no such class, a PHP Warning is triggered, but there is no usable debugging information provided. Therefore, throw an exception.

However, if you are not satisfied with the is_sbuclass_of call, please feel free to remove it and to mark this tacket as invalid. My patch was only intended to add the debug info.

@doctrinebot commented on GitHub (Feb 23, 2010): Comment created by shurakai: Roman, this is already performed by calling is_subclass_of in ClassMetadataInfo, line 1437 (in setDiscriminatorMap() ). However, if there is no such class, a PHP Warning is triggered, but there is no usable debugging information provided. Therefore, throw an exception. However, if you are not satisfied with the is_sbuclass_of call, please feel free to remove it and to mark this tacket as invalid. My patch was only intended to add the debug info.
Author
Owner

@doctrinebot commented on GitHub (Feb 23, 2010):

Comment created by romanb:

I see, thats a pity but is_subclass_of is necessary. I will apply your patch a bit differently to avoid some unnecessary calls. Thanks!

@doctrinebot commented on GitHub (Feb 23, 2010): Comment created by romanb: I see, thats a pity but is_subclass_of is necessary. I will apply your patch a bit differently to avoid some unnecessary calls. Thanks!
Author
Owner

@doctrinebot commented on GitHub (Feb 23, 2010):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Feb 23, 2010): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Dec 13, 2015):

Imported 1 attachments from Jira into https://gist.github.com/b111e8547eb6b8949b51

@doctrinebot commented on GitHub (Dec 13, 2015): Imported 1 attachments from Jira into https://gist.github.com/b111e8547eb6b8949b51 - [10378_unknown_class_in_discriminator_map.patch](https://gist.github.com/b111e8547eb6b8949b51#file-10378_unknown_class_in_discriminator_map-patch)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#441