In this situation I have 3 related entities
profile
--OneToMany--> annualReports
--ManyToOne--> photo
And in a loop, for a table I am checking for the existence of the photo in twig like this
{% set is_photo = profile.annualReports.toArray()[0].photo.id is defined %}
So, a profile
can have a lot of annualReports
- this paticular situation I want the very first "report" only.
The question is how do I do this in the QueryBuilder
? That is join the "first Report" ("first" can be based on minimum id or createdAt date)
UPDATE: I guess the question is how can I 'LIMIT 1' and specify a sort?