src/Form/InscriptionForm.php line 23
<?phpnamespace App\Form;use Symfony\Component\Form\AbstractType;use Symfony\Component\Form\Extension\Core\Type\CheckboxType;use Symfony\Component\Form\Extension\Core\Type\ChoiceType;use Symfony\Component\Form\Extension\Core\Type\EmailType;use Symfony\Component\Form\Extension\Core\Type\PasswordType;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;use Symfony\Component\Validator\Constraints\Type;use Symfony\Config\Twig\NumberFormatConfig;/*** Reset password email form** @package App\Form\*/class InscriptionForm 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('inscription'))->add('type', ChoiceType::class, ['choices' => ['Distributeur' => 'ROLE_DISTRIBUTEUR','Installateur' => 'ROLE_INSTALLATEUR' ,'Prescripteur' => 'ROLE_PRESCRIPTEUR' ,'Utilisateur particulier' => 'ROLE_USER_PARTICULIER','Utilisateur professionnel' => 'ROLE_USER_PROFESIONNEL'],'expanded' => false,'multiple' => false,'label' => 'Vous êtes','constraints' => [new NotBlank(['message' => 'Veuillez choisir un type de compte'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('nom', TextType::class, ['label' => 'Nom','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre nom'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('prenom', TextType::class, ['label' => 'Prénom','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre prénom'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('tel', TextType::class, ['label' => 'Téléphone','help' => 'Format : 0123456789','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre numéro de téléphone']),new Type(['type' => 'numeric','message' => 'Veuillez saisir un numéro de téléphone valide'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('email', EmailType::class, ['label' => 'Email','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre email']),new Email(['message' => 'Veuillez saisir un email valide'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('societe', TextType::class, ['label' => 'Société','required' => false,'constraints' => [new NotBlank(['message' => 'Veuillez saisir le nom de votre société'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('fonction', TextType::class, ['label' => 'Fonction','required' => false,'constraints' => [new NotBlank(['message' => 'Veuillez saisir votre fonction'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('adresse', TextType::class, ['label' => 'Adresse','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre adresse'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('codePostal', TextType::class, ['label' => 'Code postal','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre code postal']),new Type(['type' => 'numeric','message' => 'Veuillez saisir un code postal valide'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('ville', TextType::class, ['label' => 'Ville','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre ville'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('password', PasswordType::class, ['label' => 'Mot de passe','constraints' => [new NotBlank(['message' => 'Veuillez saisir votre mot de passe'])],'attr' => ['class' => 'form-control mt-2 mb-2']])->add('newsletter', CheckboxType::class, ['label' => 'Je souhaite recevoir la newsletter','required' => false,'attr' => ['class' => 'form-check-input']]);}}