]> Raphaƫl G. Git Repositories - userbundle/blobdiff - Form/RegisterType.php
Fix civility to have default value and not forced value
[userbundle] / Form / RegisterType.php
index bfedcf72faa6278eb6a3ca2f088db05d94b4b15b..f4327c0f27b3bd95fbe9e6fd9695109ab3901160 100644 (file)
@@ -21,6 +21,7 @@ class RegisterType extends AbstractType {
         * {@inheritdoc}
         */
        public function buildForm(FormBuilderInterface $builder, array $options) {
+               //Create form
                $form = $builder;
 
                //Add extra mail field
@@ -30,7 +31,7 @@ class RegisterType extends AbstractType {
 
                //Add extra civility field
                if (!empty($options['civility'])) {
-                       $form->add('civility', EntityType::class, ['class' => $options['civility_class'], 'attr' => ['placeholder' => 'Your civility'], 'constraints' => [new NotBlank(['message' => 'Please provide your civility'])], 'choice_translation_domain' => true, 'data' => $options['civility_default']]);
+                       $form->add('civility', EntityType::class, ['class' => $options['civility_class'], 'attr' => ['placeholder' => 'Your civility'], 'constraints' => [new NotBlank(['message' => 'Please provide your civility'])], 'choice_translation_domain' => true, 'empty_data' => $options['civility_default']]);
                }
 
                //Add extra pseudonym field