I have a form in symfony 2 like:
$form = $this->createFormBuilder();
$form
->add('subscription', 'entity', array(
'class' => 'AcmeDemoBundle:Subscription',
'property' => 'name',
'label' => 'Subscription',
'cascade_validation' => false,
'constraints' => array(
new NotBlank(),
)
))
这个出错了,错误信息是:
subscription: ERROR: This value should be of type integer. ERROR: This value should be of type integer.
问题是我不想将验证级联到订阅实体。我只想能够从下拉菜单中选择实体。
有什么建议吗?