src/Form/ResetPasswordRequestFormType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Validator\Constraints\Email;
  8. use Symfony\Component\Validator\Constraints\Length;
  9. use Symfony\Component\Validator\Constraints\NotBlank;
  10. class ResetPasswordRequestFormType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('email'EmailType::class, [
  16.                 'label' => 'Email',
  17.                 'attr' => [
  18.                     'maxlength' => 180
  19.                 ],
  20.                 'constraints' => [
  21.                     new NotBlank([
  22.                         'message' => 'Veuillez entrer votre email !',
  23.                     ]),
  24.                     new Email([
  25.                         'message' => 'L\'adresse email "{{ value }}" n\'est pas valide.',
  26.                     ])
  27.                 ],
  28.                 'required' => true,
  29.             ])
  30.         ;
  31.     }
  32.     public function configureOptions(OptionsResolver $resolver): void
  33.     {
  34.         $resolver->setDefaults([]);
  35.     }
  36.     /**
  37.      * {@inheritdoc}
  38.      */
  39.     public function getBlockPrefix()
  40.     {
  41.         return 'sg_forgot_password';
  42.     }
  43. }