我有一个带有此代码定义字段的表单:
$builder->add('folders', 'choice', array(
'multiple' => true,
'expanded' => true,
'choices' => $this->folderManager->getMailboxes(true),
'required' => false,
'label' => 'Folders:'
));
由以下内容呈现:
{{ form_widget(form.folders) }}
在提交表格后提出异常提升:
Expected argument of type "object or array", "boolean" given
什么错了?其他一切都运转正常。无论我是否勾选列表上的任何复选框,仍然会出现相同的错误。
代码在处理程序中的bindREquest
行失败:
public function process()
{
$search = new MbmMailSearch();
$search->flag_answered = "bz";
$search->flag_deleted = "bz";
$search->flag_flag = "bz";
$search->flag_seen = "bz";
$search->date_type = "on";
$this->form->setData($search);
if ('POST' == $this->request->getMethod()) {
$this->form->bindRequest($this->request);
if ( $this->form->isValid() ) {
return true;
}
}
return false;
}
我刚刚开始处理该表单,这就是为什么没有数据处理代码。
修改 完整的堆栈跟踪 http://pastebin.com/gK6HVdAV