In this example:
we see that
SELECT e FROM Entities\Employee e WHERE e.name = 'test'
makes this query:
SELECT p0_.id AS id0, p0_.name AS name1, p0_.department AS department2,
p0_.discr AS discr3 FROM Person p0_ WHERE (p0_.name = ?) AND p0_.discr IN ('employee')
Is there a way to query records only with the discriminator “Person”?
This:
SELECT e FROM Entities\Person e WHERE e.name = 'test'
returns all the records.
Any ideas?
By default the parent entity in a Inheritance Mapped Entity does not seem to use the Discriminator rules.
I got round this by creating a base class/entity.
Now Person will use discriminator rules, you need never directly reference PersonBase.