src/Form/ResetPasswordRequestFormType.php line 12

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\NotBlank;
  8. use Symfony\Contracts\Translation\TranslatorInterface;
  9. class ResetPasswordRequestFormType extends AbstractType
  10. {
  11.     public $translator;
  12.     
  13.     public function __construct(TranslatorInterface $translator)
  14.     {
  15.         $this->translator $translator;
  16.     }
  17.     
  18.     public function buildForm(FormBuilderInterface $builder, array $options): void
  19.     {
  20.         $builder
  21.             ->add('email'EmailType::class, [
  22.                 'attr' => ['autocomplete' => 'off'],
  23.                 'constraints' => [
  24.                     new NotBlank([
  25.                         'message' => $this->translator->trans('reset_password.alert_enter_email'),
  26.                     ]),
  27.                 ],
  28.             ])
  29.         ;
  30.     }
  31.     public function configureOptions(OptionsResolver $resolver): void
  32.     {
  33.         $resolver->setDefaults([]);
  34.     }
  35. }