I have a polymorphic association (Class Table Inheritance) and I need use DQL to query entities of a specific child class wich can be done using "x INSTANCE OF Entity" in WHERE clause. Now I need to put conditions specific for that child class but I get this error:
"Class Person has no association named student_field_1"
Person = Parent Class
Employee = Child class
Student = Child class
is there any way yo cast of somehow tell Doctrine that the Person is actually a Student and to allow me to put Student fields in the WHERE?
It sounds like a "Mapped Superclass" would be more suited to what your trying to do as it doesn't require an explicit link between parent / child, its just simple inheritance.
With Class Table Inheritance your required to provide discriminator map that links the two entities through a key.
"The table of a child class should be linked to the table of a parent class through a foreign key constraint"
If you're only querying students, then why don't you just do this?
SELECT s FROM Student s WHERE s.student_field_1 = ...