我想为我的用户角色集合创建一个下拉 dwon 菜单,如下所示:
class UserType extends AbstractType
{
public function buildForm(FormBuilder $builder, array $options)
{
$builder
->add('userRoles',null, array('multiple'=>false))
;
}
但我收到此错误消息:
Expected an object, but got a collection. Did you forget to pass
"multiple=true" to an entity field?
任何想法如何使收藏不能多选!?