]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Form/SessionType.php
Fix buildForm to match upstream prototype and return value
[airbundle] / Form / SessionType.php
index d6f1ba3095d841abea876e9927a2526c23964936..f7c0756bceca0040d235e9cb5007aa0bdaf58192 100644 (file)
@@ -55,19 +55,19 @@ class SessionType extends AbstractType {
                        if (!empty($options['admin'])) {
                                $builder
                                        //Add dance field
-                                       ->add('dance', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Dance', 'choices' => $options['dance_choices'], 'preferred_choices' => $options['dance_favorites'], 'attr' => ['placeholder' => 'Your dance'], 'choice_translation_domain' => true, 'constraints' => [new NotBlank(['message' => 'Please provide your dance'])], 'data' => $options['dance_default']])
+                                       ->add('dance', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Dance', 'choices' => $options['dance_choices'], 'preferred_choices' => $options['dance_favorites'], 'attr' => ['placeholder' => 'Your dance'], 'choice_translation_domain' => true, 'constraints' => [new NotBlank(null, 'Please provide your dance')], 'data' => $options['dance_default']])
 
                                        //Add slot field
-                                       ->add('slot', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Slot', 'attr' => ['placeholder' => 'Your slot'], 'constraints' => [new NotBlank(['message' => 'Please provide your slot'])], 'choice_translation_domain' => true, 'data' => $options['slot_default']])
+                                       ->add('slot', EntityType::class, ['class' => 'Rapsys\AirBundle\Entity\Slot', 'attr' => ['placeholder' => 'Your slot'], 'constraints' => [new NotBlank(null, 'Please provide your slot')], 'choice_translation_domain' => true, 'data' => $options['slot_default']])
                                        //Add date field
-                                       ->add('date', DateType::class, ['attr' => ['placeholder' => 'Your date', 'class' => 'date'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'data' => $options['date'], 'constraints' => [new NotBlank(['message' => 'Please provide your date']), new Type(['type' => \DateTime::class, 'message' => 'Your date doesn\'t seems to be valid'])]]);
+                                       ->add('date', DateType::class, ['attr' => ['placeholder' => 'Your date', 'class' => 'date'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'format' => 'yyyy-MM-dd', 'data' => $options['date'], 'constraints' => [new NotBlank(null, 'Please provide your date'), new Type(['type' => \DateTime::class, 'message' => 'Your date doesn\'t seems to be valid'])]]);
                        }
 
                        $builder
                                //TODO: avertissement + minimum et maximum ???
-                               ->add('begin', TimeType::class, ['attr' => ['placeholder' => 'Your begin', 'class' => 'time'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'data' => $options['begin'], 'constraints' => [new NotBlank(['message' => 'Please provide your begin']), new Type(['type' => \DateTime::class, 'message' => 'Your begin doesn\'t seems to be valid'])]])
+                               ->add('begin', TimeType::class, ['attr' => ['placeholder' => 'Your begin', 'class' => 'time'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'data' => $options['begin'], 'constraints' => [new NotBlank(null, 'Please provide your begin'), new Type(['type' => \DateTime::class, 'message' => 'Your begin doesn\'t seems to be valid'])]])
                                //TODO: avertissement + minimum et maximum ???
-                               ->add('length', TimeType::class, ['attr' => ['placeholder' => 'Your length', 'class' => 'time'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'data' => $options['length'], 'constraints' => [new NotBlank(['message' => 'Please provide your length']), new Type(['type' => \DateTime::class, 'message' => 'Your length doesn\'t seems to be valid'])]])
+                               ->add('length', TimeType::class, ['attr' => ['placeholder' => 'Your length', 'class' => 'time'], 'html5' => true, 'input' => 'datetime', 'widget' => 'single_text', 'data' => $options['length'], 'constraints' => [new NotBlank(null, 'Please provide your length'), new Type(['type' => \DateTime::class, 'message' => 'Your length doesn\'t seems to be valid'])]])
                                ->add('modify', SubmitType::class, ['label' => 'Modify', 'attr' => ['class' => 'submit']]);
                }
 
@@ -82,7 +82,7 @@ class SessionType extends AbstractType {
                        $locations = $this->doctrine->getRepository(Location::class)->findComplementBySessionId($options['session']);
                        $builder
                                //TODO: class senior en orange ???
-                               ->add('location', ChoiceType::class, ['attr' => ['placeholder' => 'Your location'], 'constraints' => [new NotBlank(['message' => 'Please provide your location'])], 'choices' => $locations, 'choice_translation_domain' => true])
+                               ->add('location', ChoiceType::class, ['attr' => ['placeholder' => 'Your location'], 'constraints' => [new NotBlank(null, 'Please provide your location')], 'choices' => $locations, 'choice_translation_domain' => true])
                                ->add('move', SubmitType::class, ['label' => 'Move', 'attr' => ['class' => 'submit']]);
                }
 
@@ -93,7 +93,7 @@ class SessionType extends AbstractType {
                        //Add admin fields
                        $builder
                                //TODO: class admin en rouge ???
-                               ->add('user', ChoiceType::class, ['attr' => ['placeholder' => 'Your user'], 'constraints' => [new NotBlank(['message' => 'Please provide your user'])], 'choices' => $users, 'data' => $options['user'], 'choice_translation_domain' => false])
+                               ->add('user', ChoiceType::class, ['attr' => ['placeholder' => 'Your user'], 'constraints' => [new NotBlank(null, 'Please provide your user')], 'choices' => $users, 'data' => $options['user'], 'choice_translation_domain' => false])
                                ->add('lock', SubmitType::class, ['label' => 'Lock', 'attr' => ['class' => 'submit']]);
 
                        //Is admin and locked === null