mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-141: DQL with WHERE queries on Single Table Inheritance Entities fail #175
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 13, 2009).
Jira issue originally created by user nicokaiser:
The ORM query builder seems to be broken for Single Table Inheritance with discriminator.
When using inheritance like here:
http://www.doctrine-project.org/documentation/manual/2_0/en/inheritance-mapping#single-table-inheritance
Queries with WHERE fail:
SELECT p FROM MyProject\Model\Person p WHERE p.id = 1This translates to this SQL:
SELECT p0*.id AS id0, p0_.discr AS discr1 FROM person p0_ WHERE p0_.id = 1 p0*.discr IN ('', 'person', 'employee')(AND is missing after p0_.id = 1)
@doctrinebot commented on GitHub (Nov 13, 2009):
Comment created by romanb:
Thanks for reporting this. I'm just wondering where the empty string in the IN clause comes from? I dont seem to be able to reproduce that bit.
@doctrinebot commented on GitHub (Nov 13, 2009):
Comment created by nicokaiser:
Argh, ignore the empty string, it is
SELECT p0*.id AS id0, p0_.discr AS discr1 FROM person p0_ WHERE p0_.id = 1 p0*.discr IN ('person', 'employee')My initial example was a superclass that did not appear in the DiscriminatorMap...
@doctrinebot commented on GitHub (Nov 13, 2009):
Comment created by romanb:
OK. Should be fixed now. Was a very trivial mistake. Now its covered in the tests.
@doctrinebot commented on GitHub (Nov 13, 2009):
Issue was closed with resolution "Fixed"