You have to create your custom form first, such as this for example
// src/AppBundle/Form/UserType.php
namespace AppBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
class UserType extends AbstractType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder->add('name');
}
public function getParent() {
return 'FOS\UserBundle\Form\Type\UserFormType';
// Or for Symfony < 2.8
// return 'fos_user_profile_edit';
}
public function getBlockPrefix() {
return 'app_user_profile';
}
// For Symfony 2.x
public function getName(){
return $this->getBlockPrefix();
}
}
Configure your form type as a service
# app/config/services.yml
services:
app.form.profile:
class: AppBundle\Form\UserType
tags:
- { name: form.type, alias: app_user_profile }
and your configuration file to extend/override
# app/config/config.yml
fos_user:
# ...
profile:
form:
type: AppBundle\Form\UserType
# if you are using Symfony < 2.8 you should use the type name instead
# type: app_user_profile