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:
Queries with WHERE fail:
SELECT p FROM MyProject\Model\Person p WHERE p.id = 1
This 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)
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.
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...
OK. Should be fixed now. Was a very trivial mistake. Now its covered in the tests.
Issue was closed with resolution "Fixed"