src/Form/GetResetPasswordEmailForm.php line 18
<?php
namespace App\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\EmailType;
use Symfony\Component\Form\Extension\Core\Type\TextType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
/**
* Reset password email form
*
* @package App\Form\
*/
class GetResetPasswordEmailForm extends AbstractType
{
private UrlGeneratorInterface $urlGenerator;
public function __construct(UrlGeneratorInterface $urlGenerator)
{
$this->urlGenerator = $urlGenerator;
}
/**
* @inheritDoc
*
* @param FormBuilderInterface $builder
* @param array $options
*
* @throws \Symfony\Component\Routing\Exception\InvalidParameterException
* @throws \Symfony\Component\Routing\Exception\MissingMandatoryParametersException
* @throws \Symfony\Component\Routing\Exception\RouteNotFoundException
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->setAction($this->urlGenerator->generate('motDePasseRecuperation'))
->add('email',EmailType::class, [
'label' => 'Email',
'required' => true,
'constraints' => [
new NotBlank([
'message' => 'Veuillez saisir votre email',
]),
new Email([
'message' => 'Veuillez saisir un email valide',
]),
],
'attr' => ['class' => 'form-control mt-2 mb-2'],
]);
}
}