I’m trying to override FOSUserBundle form “Edit profile” ; I have created the class EditFormType under AP/UserBundle/Form/Type as :
<?php
namespace FOS\UserBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use FOS\UserBundle\Form\Type\ProfileFormType as BaseType;
class EditFormType extends BaseType
{
public function buildForm(FormBuilder $builder, array $options)
{
$child = $builder->create('user', 'form', array('data_class' => $this->class));
$this->buildUserForm($child, $options);
$builder
->add($child)
->add('Mot de passe', 'password')
->add('Nom', 'nom')
->add('Prénom', 'prenom')
->add('Civilité', 'civilite')
->add('Newsletter', 'new_letter')
;
}
public function getDefaultOptions(array $options)
{
return array('data_class' => 'FOS\UserBundle\Form\Model\CheckPassword');
}
public function getName()
{
return 'ap_edit_profile';
}
}
Then, I’ve created my services AP/UserBundle/Resources/config/services.yml :
services:
ap_user.edit.form.type:
class: AP\UserBundle\Form\Type\EditFormType
arguments: [%fos_user.model.user.class%]
tags:
- { name: form.type, alias: ap_edit_profile }
And lastly, I updated app/config/config.yml :
fos_user:
profile:
form:
type: ap_edit_profile
And I’ve finally got this error : Could not load type "ap_edit_profile"
What can be wrong ?
Thanks !
I suppose problem in this part of configuration
it should look like