おそらく、例が私の問題を最もよく説明するでしょう:
スキーマ:
Referral:
actAs: { timestampable: ~ }
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
other_stuff: { type: string }
reasonCode: { type: integer }
relations:
ReasonCode: { local: reasonCode, foreign: id, foreignAlias: ReasonCodes }
ReasonCode:
columns:
id: { type: integer, primary: true, notnull: true, autoincrement: true, unique: true }
description: { type: string }
クエリ(referralTable.class.php):
public function getObjectByReferralId($id){
$q = Doctrine_Query::create()
->select('*')
->from('referral_submissions')
->where('referral_id=?', $id)
->fetchOne();
return $q;
}
テンプレートを呼び出す:
<?php
$id = <source of id>;
echo Doctrine_Core::getTable('referral')->getObjectByReferralId($id)->getReasonCode();
?>
理由コードを取得するためのテンプレートでの上記の呼び出しは、Referralテーブルに格納されているIDではなく、ReasonCodeテーブルに格納されている「説明」を返します。結合された説明ではなく、実際のIDが必要です。私は何が欠けていますか?