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\Email;
  8. use Symfony\Component\Validator\Constraints\NotBlank;
  9. class ResetPasswordRequestFormType extends AbstractType
  10. {
  11.     public function buildForm(FormBuilderInterface $builder, array $options): void
  12.     {
  13.         $builder
  14.             ->add('email'EmailType::class, [
  15.                 'attr' => [
  16.                     'class' => 'form-control',
  17.                     'placeholder' => 'Enter Email'
  18.                     ],
  19.                 'constraints' => [
  20.                     new NotBlank([
  21.                         'message' => 'Please enter your email',
  22.                     ]),
  23.                     new Email([
  24.                         'message' => 'Please enter valid a email',
  25.                     ])
  26.                 ],
  27.             ])
  28.         ;
  29.     }
  30.     public function configureOptions(OptionsResolver $resolver): void
  31.     {
  32.         $resolver->setDefaults([]);
  33.     }
  34. }