0
我搜索了很長時間,但是我沒有設法在一個查詢中檢索兩個相關的對象。我正在使用Doctrine和Symfony(默認情況下使用Doctrine)。用Doctrine和Symfony檢索相關對象
這裏是我的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();
}
的報告已被提交一個地方的成員。我需要檢索成員對象來顯示它的字段,但我真的不知道該怎麼做。
如果您有線索或方法來做到這一點,我會非常感謝您的幫助。
我已經嘗試過類似的東西與一些leftJoin但symfony的拋出這樣的例外: 500 |內部服務器錯誤| Doctrine_Table_Exception 未知的關係別名成員 – Cyril 2010-07-16 17:17:03
有關信息,我清除緩存,並在問題 – Cyril 2010-07-16 17:18:39
粘貼的關係嗯我的錯誤,它應該是成員,而不是成員。 – DuoSRX 2010-07-16 17:28:27