Remove/unset form fields in Symfony2
fosuserbundle, symfony, symfony-forms
Solution
If you want to remove/unset some field in your form type which extends FOSUser one you can do something like:
public function buildForm(FormBuilder $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->remove('username');
}
Problem
I am working on extending the FosUserBundle registration form. I need to remove/unset the username field (because I am using email as the username). Is there a way to remove a field from a form that I am extending?