mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-378: Allow configuring of discriminatorMap from child classes #469
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @doctrinebot on GitHub (Feb 26, 2010).
Jira issue originally created by user @jwage:
Would be nice if I could define this information from the child class so that I can drop in new tops without having to change the parent.
@doctrinebot commented on GitHub (Feb 26, 2010):
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by @beberlei:
This isn't really possible in a straightforward way, the Parent class has to know all the children to be able to transform a query like:
into their specific entities. These wouldn't be known however, since they are defined on a children.
@doctrinebot commented on GitHub (Feb 26, 2010):
Comment created by @jwage:
Is it possible any other way to add to the discriminator map dynamically? Imagine I have a CMS with a base Node entity and a NodeType and I want to easily drop in new node types without having to modify the Node entity because the Node will not be something I own or have control over.
@doctrinebot commented on GitHub (Feb 27, 2010):
Comment created by @jwage:
What about if I hook into the loadClassMetadata event in ClassMetadataFactory and add to the discriminator map?
@doctrinebot commented on GitHub (Mar 20, 2010):
Comment created by romanb:
Jon, I think that last suggestion might work. The CMS would need to provide a way for the user to configure its own subclasses (say $cmsConfig->registerSubclass('MyCustomNode', 'Node'). The CMS itself can hook into loadClassMetadata and add the stuff from its config to the discriminator map.
@doctrinebot commented on GitHub (Mar 20, 2010):
Comment created by romanb:
Here an example how that might look like at the moment:
@doctrinebot commented on GitHub (Mar 20, 2010):
Comment created by @jwage:
Sweet, this solution works for me. As long as we can add in new children in some way without having to modify the parents mapping information directly.
@doctrinebot commented on GitHub (Mar 20, 2010):
Issue was closed with resolution "Can't Fix"