我设法覆盖模板和注册页面的表单,但我注意到的一件事是最初的字段被注入。FOSUserBundle,SonataUserBundle覆盖注册
这是我buildform代码:
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('firstname', 'text', array('label' => 'First Name'))
->add('lastname', 'text', array('label' => 'Last Name'))
->add('over_18', 'checkbox', array('label' => 'Yes I am over 18', 'mapped' => false))
->add('email', 'text', array('label' => 'Email'))
->add('phone', 'text', array('label' => 'What is your telephone number?'))
->add('password', 'password', array('label' => 'Choose a password'))
;
}
当我在模板做{{ dump(form) }}
我得到这个:
我知道我可以做$ builder->删除()在这些领域,但如果我覆盖表单我应该真的需要这样做吗?
谢谢