I'm trying to remove the username field from the FOSUserBundle registration form as described in step 2 in this answer.
This is the FormType class I've created in order to override the default:
<?php
// src/UserBundle/Form/Type/RegistrationFormType.php
namespace UserBundle\Form\Type;
use FOS\UserBundle\Form\Type\RegistrationFormType as BaseFormType;
class RegistrationFormType extends BaseFormType
{
public function buildForm(FormBuilder $builder, array $options)
{
parent::buildForm($builder, $options);
$builder->remove('username');
}
}
The username fields still shows up in the form, however. What am I missing?