I searched for a long time, but I don't manage to retrieve two related object in one query. I am using Doctrine and Symfony (uses Doctrine by default).
Here is a part of my schema.yml:
Member:
columns:
...some fields...
Report:
columns:
member: { type: integer, notnull: true }
...some fields...
relations:
Member: { onDelete: CASCADE, local: member, foreign: id, foreignAlias: Members }
And this my "basic" request which works to retrieve only the report object:
public function getReports($place,$max = 5) {
$q = Doctrine_Query::create()
->from('Report sr')
->where('sr.place = ?',$place)
->limit($max)
->orderBy('sr.date DESC');
return $q->execute();
}
A report has been committed by a member in a place. I need to retrieve the member object to display it with his fields but I really don't know how to do that.
If you have a clue or method to do that, I'll really appreciate your help.