src/App/Form/Type/RequestPasswordResetType.php line 12

Open in your IDE?
  1. <?php declare(strict_types=1);
  2. namespace App\Form\Type;
  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\NotBlank;
  9. class RequestPasswordResetType extends AbstractType
  10. {
  11.     /**
  12.      * @param mixed[] $options
  13.      */
  14.     public function buildForm(FormBuilderInterface $builder, array $options): void
  15.     {
  16.         $builder->add('email'EmailType::class, [
  17.             'label' => 'request.form.email',
  18.             'constraints' => [
  19.                 new NotBlank(['message' => 'email.empty']),
  20.                 new Email(['message' => 'email.invalid']),
  21.             ],
  22.         ]);
  23.     }
  24.     public function configureOptions(OptionsResolver $resolver): void
  25.     {
  26.         $resolver->setDefaults([
  27.             'translation_domain' => 'forgot_password',
  28.         ]);
  29.     }
  30. }