Symfony 1.4 とドクトリンを使用しています。左結合でクエリを作成したい:
SELECT * FROM table1 LEFT JOIN table2 on table1.id = table2.table1_id ...
私はこのようにしました:
Doctrine_Query::create()
->select('*')
->from('Table1 t')
->leftJoin('Table2 t2')
...
Table1 と Table2 の間に schema.yml 関係があります
relations:
Table2:
class: Table2
local: id
foreign: table1_id
onDelete: cascade
type: one
foreignType: one
foreignAlias: Table1Table2
最後に、次のようなクエリを取得します。
SELECT * FROM table1, table2 ...
LEFT JOIN 句はありません。理由を知っている人はいますか?