If I understand you correctly, DocType
is a mapped superclass and Paper, Video, Discussion extend it. In that case, you could just add OneToMany
relation from DocType
to Comment
.
This should create a field doctype_id
in your comments
table referencing doctype
table. This is assuming you're using class table inheritance.
You could then just do:
$paper = $this->getDoctrine()->getRepository('Papers\Class\Here')->find(5238953);
$paper->getComments();