X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/15bd07b88ef06f2f33a3dcc97ad7ab5b1a3624d4..f2b9304f79c3dfbf8314d1f96762c628b790a87a:/Form/SessionType.php diff --git a/Form/SessionType.php b/Form/SessionType.php index b42b26a..d6f1ba3 100644 --- a/Form/SessionType.php +++ b/Form/SessionType.php @@ -39,7 +39,7 @@ class SessionType extends AbstractType { * * {@inheritdoc} */ - public function buildForm(FormBuilderInterface $builder, array $options) { + public function buildForm(FormBuilderInterface $builder, array $options): void { //Is admin or user with rainfall >= 2 if (!empty($options['raincancel'])) { //Add raincancel item @@ -55,10 +55,10 @@ class SessionType extends AbstractType { if (!empty($options['admin'])) { $builder //Add dance field - ->add('dance', EntityType::class, ['class' => 'RapsysAirBundle: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(['message' => 'Please provide your dance'])], 'data' => $options['dance_default']]) //Add slot field - ->add('slot', EntityType::class, ['class' => 'RapsysAirBundle: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(['message' => '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'])]]); } @@ -104,15 +104,12 @@ class SessionType extends AbstractType { ->add('autoattribute', SubmitType::class, ['label' => 'Auto attribute', 'attr' => ['class' => 'submit']]); } } - - //Return form - return $builder; } /** * {@inheritdoc} */ - public function configureOptions(OptionsResolver $resolver) { + public function configureOptions(OptionsResolver $resolver): void { $resolver->setDefaults(['error_bubbling' => true, 'admin' => false, 'dance_choices' => [], 'dance_default' => null, 'dance_favorites' => [], 'date' => null, 'begin' => null, 'length' => null, 'cancel' => false, 'raincancel' => false, 'modify' => false, 'move' => false, 'attribute' => false, 'user' => null, 'session' => null, 'slot_default' => null]); //Add admin @@ -161,7 +158,7 @@ class SessionType extends AbstractType { /** * {@inheritdoc} */ - public function getName() { - return 'rapsys_air_session_edit'; + public function getName(): string { + return 'rapsysair_session_edit'; } }