我有一个收集表格
class MyCollectionForm extends sfForm
{
public function configure()
{
parent::configure();
$this->widgetSchema->setNameFormat('my_collection[%s]');
$groups = Doctrine::getTable('QuotaGroup')->findAll(); //existing groups
foreach ($groups as $i => $group)
{
$groupForm = new QuotaGroupForm($group);
$this->embedForm($i, $groupForm);
}
$i++;
$this->embedForm($i, new QuotaGroupForm(new QuotaGroup())); //new group
$this->mergePostValidator(new QuotaGroupValidatorSchema());
}
}
在我执行的保存操作中:
$this->form->bind($params);
if($this->form->isValid())
{
$this->form->save();
}
我收到错误:调用未定义的方法MyCollectionForm :: save()
我找不到错误,因为sfForm有一个保存方法......
答案 0 :(得分:1)
sfForm没有保存方法......
你应该扩展sfFormDoctrine。
class MyCollectionForm extends sfFormDoctrine{ ...