mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
DDC-131: Cannot select entities with inheritance mapping when it's not a subclass #164
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 (Nov 9, 2009).
Jira issue originally created by user reinier.kip:
I'm actually not sure whether this is a bug or an improvement.
I find this a bit difficult to explain, so I'll use this example:
ParentClass uses class inheritance mapping and specifies SubClass as one of its subclasses. I instantiate a new ParentClass and store it in the database. Thus, the discriminator column is null. When selecting the same record from the database, it fails, as ReflectionClass cannot find the class null. This can easily be solved with attached patch. Whenever Doctrine encounters a discriminator column which is null (or an empty string) it does not change the entity name, but leaves it at ParentClass, resulting in a correct instance of ParentClass.
@doctrinebot commented on GitHub (Nov 9, 2009):
Comment created by reinier.kip:
Ah, the tests show this is actually expected behaviour and that I should actually put ParentClass in the discriminator map as well. Marking as 'won't fix'. Sorry for spamming Jira, I'll put more effort into tracking down why my code isn't working and not immediately blame you guys.
@doctrinebot commented on GitHub (Nov 9, 2009):
Issue was closed with resolution "Won't Fix"
@doctrinebot commented on GitHub (Nov 9, 2009):
Comment created by romanb:
You can not have a concrete (non-abstract) mapped parent class that is not in the discriminator map. The discriminator map is not only for subclasses. In the discriminator map you must specify a mapping from a discriminator value to a class name for all concrete (instantiable) classes in the mapped inheritance hierarchy.
@doctrinebot commented on GitHub (Nov 9, 2009):
Comment created by romanb:
No worries. As far as I'm concerned its better you create an issue that turns out to be invalid rather than the other way around where we are not being notified of a potential issue just because you are not sure.
When in doubt about something, report it!
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/3e40bafd6adb454e7980