没有找到与Doctrine2的多态关联领域 [英] Not finding field in polymorphic association with Doctrine2
问题描述
类人没有关联名为student_field_1
Person = Parent Class
Employee =子类
学生=子类
有没有办法,你以某种方式告诉学说,该人实际上是一个学生,并允许我把学生字段放在WHERE?
如果您只是询问学生,那么为什么不这样做?
SELECT s FROM Student s WHERE s.student_field_1 = ...
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?
If you're only querying students, then why don't you just do this?
SELECT s FROM Student s WHERE s.student_field_1 = ...
这篇关于没有找到与Doctrine2的多态关联领域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!