1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| class ProfessionnelType extends RegistrationFormType {
public function buildForm(FormBuilderInterface $builder, array $options) {
$builder
->add('email', 'repeated', array(
'type' => 'email',
'first_options' => array('label' => 'form.email'),
'second_options' => array('label' => 'form.email_confirmation'),
'invalid_message' => 'fos_user.email.mismatch',
))
->add('nom', null, array('label' => 'nom', 'translation_domain' => 'FOSUserBundle'))
->add('prenom', null, array('label' => 'Prénom', 'translation_domain' => 'FOSUserBundle'))
->add('telephone', null, array('label' => 'Numéro de téléphone'))
->add('fonction', null, array('label' => 'Fonction'))
->add('username', null, array('label' => 'form.username', 'translation_domain' => 'FOSUserBundle'))
->add('plainPassword', 'repeated', array(
'type' => 'password',
'options' => array('translation_domain' => 'FOSUserBundle'),
'first_options' => array('label' => 'form.password'),
'second_options' => array('label' => 'form.password_confirmation'),
'invalid_message' => 'fos_user.password.mismatch',
))
->add('cgu', 'checkbox', array(
'label' => 'Acceptation des CGU',
'required' => true,
"mapped" => false,
)) ;
}
public function setDefaultOptions(OptionsResolverInterface $resolver) {
$resolver->setDefaults([
'compound' => true,
'data_class' => 'My\SiteBundle\Entity\Professionnel',
'cascade_validation' => true,
]);
}
public function getName() { return 'professionnel'; }
} |
Partager