Symfony:如何使用多个复选框从sfWidgetFormDoctrineChoice保存数据

时间:2011-09-21 19:52:31

标签: symfony1 doctrine

我在选择小部件中保存数据时遇到问题。 这是架构的一部分:

Client:
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    grupy:
      type: array
  options:
    collate: utf8_unicode_ci
    charset: utf8   
  relations:
    Grupy:
      type: many
      local: grupy
      foreign: id
      class: KlientGrupy

KlientGrupy:
  options:
    collate: utf8_unicode_ci
    charset: utf8
  columns:
    id:
      type: integer
      primary: true
      autoincrement: true
    item:
      type: string(255)
  relations:
    Klienci:
      type: many
      local: id
      foreign: grupy

ClientForm类:

class ClientForm extends BaseClientForm
{

    public function configure()
    {
        $this->widgetSchema['grupy']->setOption('multiple', true);
        $this->widgetSchema['grupy']->setOption('expanded', true);
        $this->widgetSchema['grupy']->setOption('add_empty', false);
        $this->widgetSchema['grupy']->setAttribute('class', 'checkBoxLabel');

    }

}

BaseClientForm类:

$this->setWidgets(array(
  'id'              => new sfWidgetFormInputHidden(),
  'grupy'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Grupy'), 'add_empty' => true)),
));

当我用一个复选框保存时,一切都没问题,但当我尝试多次执行时,我遇到了这个问题:

SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens

1 个答案:

答案 0 :(得分:0)

您可以在我的问题中找到答案中的答案