我想獲得與兩個表的關係。symfony 1.4閱讀關係1:n教條
這是我的schema.yml
Oferta:
columns:
titol: { type: string(50), notnull: true }
sub_titol: { type: text }
data_inici: { type: date }
data_fi: { type: date }
Opcions:
columns:
oferta_id: { type: integer, notnull: true }
descripco: { type: string(150), notnull: true }
preu: { type: string(20), notnull: flase }
relations:
Oferta: {onDelete: CASCADE, local: oferta_id, foreign: id, foreignAlias: Opcions_FK}
的是這種方法:* @method Doctrine_Collection getOpcionsFK()返回當前記錄的 「Opcions_FK」 收集
,我有這樣的代碼:
foreach ($ofertes as $oferta) {
echo $oferta->getId();
$opcions = new Opcions();
$opcions = $oferta->getOpcionsFK(); //this line do a error Unknown record property/related component "opcions_fk" on "Oferta"
}
該錯誤:
public function filterGet(D octrine_Record $紀錄,$名)
{
throw new Doctrine_Record_UnknownPropertyException(sprintf('Unknown record property/related component "%s" on "%s"', $name, get_class($record)));
}
}
有人知道什麼是不運行它?
感謝
問候
您可以發佈完整的錯誤嗎? Gràcies;) – 2012-01-31 18:23:53
另請參見:getOpcionsFK自動生成或自定義的方法?如果由yoursef定義,你能顯示它嗎?自動生成 – 2012-01-31 18:28:14
。謝謝 – 2012-01-31 18:30:11