我想获得与两个表的关系。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