开发者

Symfony: How to save data from sfWidgetFormDoctrineChoice with multiple checkboxes

I have problem with save data from choices widget. Here is part of schema:

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:

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']->开发者_JS百科setAttribute('class', 'checkBoxLabel');

    }

}

BaseClientForm class:

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

When i save with one checkbox then all is ok, but when i try do it for more than one i get that problem:

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


You can find answer in comment in my question

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜