長い間検索しましたが、1 つのクエリで 2 つの関連オブジェクトを取得できません。DoctrineとSymfonyを使用しています (デフォルトで Doctrine を使用しています)。
これが私の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 }
そして、これはレポートオブジェクトのみを取得するために機能する私の「基本的な」リクエストです:
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();
}
場所のメンバーによってレポートがコミットされました。メンバー オブジェクトを取得してフィールドと共に表示する必要がありますが、その方法がわかりません。
それを行う手がかりや方法があれば、本当に助かります。