mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-500: Single Table Inheritance Selects #625
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 (Apr 7, 2010).
Jira issue originally created by user mridgway:
We have a set of models that use Single Table inheritance and we are trying to select all objects of one type:
Now to query for all of the Child objects we do:
but we get "Notice: Undefined index: id in ./Doctrine/ORM/UnitOfWork.php on line 1727" on the finAll() call and the objects that aren't of the correct type have their properties nulled out. This is because the query that is being executed doesn't have any conditionals for the type of model it's looking for and the ORM doesn't check to make sure that the object is of the correct type.
This could be solved by having conditionals in the SQL query (chaining a bunch of 'or' statements for all of the child objects) or by pulling back all of the objects and then filtering out what isn't of the correct type. Unfortunately neither solution seems ideal.
I'll try to make a test case for this then.
@doctrinebot commented on GitHub (Apr 7, 2010):
@doctrinebot commented on GitHub (Apr 7, 2010):
Comment created by mridgway:
Adding another child class just to be clear.
@doctrinebot commented on GitHub (Apr 7, 2010):
Comment created by romanb:
Related to DDC-497 ? Of course there should be conditionals in the query when querying for a subtype. It really surprises me that this seems not to be the case. Maybe there has been some regression.
@doctrinebot commented on GitHub (Apr 7, 2010):
Comment created by mridgway:
Attached a unit test that may or may not work.
It looks to be a similar issue for sure.
@doctrinebot commented on GitHub (Apr 8, 2010):
Comment created by mridgway:
Fixed test case. Now gives the 'Undefined index: id' error.
@doctrinebot commented on GitHub (Apr 19, 2010):
Comment created by romanb:
Reproduced successfully and working on it.
@doctrinebot commented on GitHub (Apr 26, 2010):
Comment created by romanb:
Fixed in
760ea34a0c@doctrinebot commented on GitHub (Apr 26, 2010):
Issue was closed with resolution "Fixed"
@doctrinebot commented on GitHub (Dec 13, 2015):
Imported 1 attachments from Jira into https://gist.github.com/f9bf6e2d281a60efd056