Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 58

Deprecated: Constant E_STRICT is deprecated in /var/www/PixelForce/vendor/symfony/error-handler/ErrorHandler.php on line 76
Symfony Profiler

src/Form/InscriptionAgentType.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Form\FormEvents\SecteurChoiceListListener;
  4. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  7. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  8. use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
  9. use Symfony\Component\Form\Extension\Core\Type\TelType;
  10. use Symfony\Component\Form\Extension\Core\Type\TextType;
  11. use Symfony\Component\Form\FormBuilderInterface;
  12. use Symfony\Component\Validator\Constraints\NotNull;
  13. class InscriptionAgentType extends AbstractType
  14. {
  15.     public function buildForm(FormBuilderInterface $builder, array $options): void
  16.     {
  17.         $user $options ["data"];
  18.         $builder
  19.             ->add('nom'TextType::class, [
  20.                 'label' => false,
  21.                 'attr' => [
  22.                     'placeholder' => 'Entrer votre nom'
  23.                 ],
  24.                 'constraints' => [
  25.                     new NotNull([],'Champ obligatoire')
  26.                 ]
  27.             ])
  28.             ->add('prenom'TextType::class, [
  29.                 'label' => false,
  30.                 'attr' => [
  31.                     'placeholder' => 'Entrer votre prénom'
  32.                 ],
  33.                 'constraints' => [
  34.                     new NotNull([],'Champ obligatoire')
  35.                 ]
  36.             ])
  37.             ->add('adresse'TextType::class, [
  38.                 'label' => false,
  39.                 'attr' => [
  40.                     'placeholder' => 'Votre adresse'
  41.                 ],
  42.                 "required" => false
  43.             ])
  44.             ->add('telephone'TelType::class, [
  45.                 'label' => false,
  46.                 'attr' => [
  47.                     'placeholder' => 'Numéro téléphone'
  48.                 ],
  49.                 'constraints' => [
  50.                     new NotNull([],'Champ obligatoire')
  51.                 ]
  52.             ])
  53.             ->add('codePostal'TextType::class, [
  54.                 'label' => false,
  55.                 'attr' => [
  56.                     'placeholder' => 'Code postal'
  57.                 ],
  58.                 "required" => false
  59.             ])
  60.             ->add('username'TextType::class, [
  61.                 'label' => false,
  62.                 'attr' => [
  63.                     'placeholder' => 'Nom d\'utilisateur'
  64.                 ],
  65.                 'constraints' => [
  66.                     new NotNull([],'Champ obligatoire')
  67.                 ]
  68.             ])
  69.             ->add('email'EmailType::class, [
  70.                 'label' => false,
  71.                 'attr' => [
  72.                     'placeholder' => 'Adresse mail'
  73.                 ],
  74.                 'constraints' => [
  75.                     new NotNull([],'Champ obligatoire'),
  76.                 ]
  77.             ])
  78.             // ->add('secteur', SecteurChoiceType::class, [
  79.             //     'label' => false,
  80.             //     'mapped' => false,
  81.             // ])
  82.             ->add('password'RepeatedType::class, [
  83.                 'label' => false,
  84.                 'type' => PasswordType::class,
  85.                 'invalid_message' => 'Le mot de passe saisi doit être le même.',
  86.                 'options' => [
  87.                     'attr' =>
  88.                         [
  89.                             'class' => 'password-field',
  90.                         ]
  91.                 ],
  92.                 'required' => true,
  93.                 'first_options'  => [
  94.                     'label' => false,
  95.                     'attr' => [
  96.                         'placeholder' => 'Mot de passe'
  97.                     ]
  98.                 ],
  99.                 'second_options' => [
  100.                     'label' => false,
  101.                     'attr' => [
  102.                         'placeholder' => 'Confirmation Mot de passe'
  103.                     ]
  104.                 ],
  105.                 'constraints' => [
  106.                     new NotNull([],'Champ obligatoire'),
  107.                 ],
  108.                 'mapped' => false
  109.             ])
  110.             ->add('numero_rue'TextType::class, [
  111.                 'label' => false,
  112.                 'attr' => [
  113.                     'placeholder' => 'Numéro de rue'
  114.                 ],
  115.                 "required" => false
  116.             ])
  117.             ->add('ville'TextType::class, [
  118.                 'label' => false,
  119.                 'attr' => [
  120.                     'placeholder' => 'Ville'
  121.                 ],
  122.                 "required" => false
  123.             ])
  124.             ->addEventSubscriber(new SecteurChoiceListListener())
  125.         ;
  126.         // Ajoutez le champ 'ambassador_username' si la valeur est différente de null
  127.         if ($user->getAmbassadorUsername() !== null) {
  128.             $builder->add('ambassador_username'TextType::class, [
  129.                 'label' => "Nom d'utilisateur du parrain",
  130.                 'required' => true,
  131.                 'disabled' => true
  132.             ]);
  133.         }
  134.     }
  135. }