开发者

save multiple symfony form

I have a Collection Form

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, $grou开发者_JS百科pForm);
    }

    $i++;
    $this->embedForm($i, new QuotaGroupForm(new QuotaGroup())); //new group

    $this->mergePostValidator(new QuotaGroupValidatorSchema());
  }
}

In the Save Action I do:

$this->form->bind($params);
if($this->form->isValid())
{
   $this->form->save();
}

I get an error: Call to undefined method MyCollectionForm::save()

I cant´t find the error because sfForm has a save method...


sfForm does not have a save method...

You should extend sfFormDoctrine.

class MyCollectionForm extends sfFormDoctrine{ ...
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜