src/Form/RegistrationProfessionalFormType.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use Symfony\Component\Form\AbstractType;
  4. use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
  5. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  6. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  7. use Symfony\Component\Form\Extension\Core\Type\CountryType;
  8. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  9. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  10. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  11. use Symfony\Component\Form\Extension\Core\Type\TelType;
  12. use Symfony\Component\Form\Extension\Core\Type\TextType;
  13. use Symfony\Component\Form\FormBuilderInterface;
  14. use Symfony\Component\OptionsResolver\OptionsResolver;
  15. use Symfony\Component\Validator\Constraints\IsTrue;
  16. use Symfony\Component\Validator\Constraints\Length;
  17. use Symfony\Component\Validator\Constraints\NotBlank;
  18. use App\Entity\CompagnyInfo;
  19. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  20. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  21. use App\Entity\User;
  22. class RegistrationProfessionalFormType extends AbstractType
  23. {
  24.     public function buildForm(FormBuilderInterface $builder, array $options)
  25.     {
  26.         $builder
  27.         ->add('name'TextType::class,[
  28.             'required'=>true,
  29.             'attr'=>[
  30.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  31.             ],
  32.             'label_attr'=>[
  33.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  34.             ],
  35.             'label'=>'Nom',
  36.         ])
  37.         ->add('firstname'TextType::class,[
  38.             'required'=>true,
  39.             'attr'=>[
  40.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  41.             ],
  42.             'label_attr'=>[
  43.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  44.             ],
  45.             'label'=>'Prenom',
  46.         ])
  47.         ->add('birthday'BirthdayType::class,[
  48.             'required'=>true,
  49.             'attr'=>[
  50.                 'class'=>'mb-1'
  51.             ],
  52.             'label'=>'Date de naissance',
  53.             'label_attr'=>[
  54.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  55.             ],
  56.         ])
  57.         ->add('adress'TextType::class,[
  58.             'required'=>true,
  59.             'attr'=>[
  60.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  61.             ],
  62.             'label_attr'=>[
  63.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  64.             ],
  65.             'label'=>'Adresse',
  66.         ])
  67.         ->add('postalCode'IntegerType::class,[
  68.             'required'=>true,
  69.             'attr'=>[
  70.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  71.             ],
  72.             'label_attr'=>[
  73.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  74.             ],
  75.             'label'=>'Code postal',
  76.         ])
  77.         ->add('city'TextType::class,[
  78.             'required'=>true,
  79.             'attr'=>[
  80.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  81.             ],
  82.             'label_attr'=>[
  83.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  84.             ],
  85.             'label'=>'ville',
  86.         ])
  87.         ->add('country'CountryType::class,[
  88.             'required'=>true,
  89.             'attr'=>[
  90.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  91.             ],
  92.             'label_attr'=>[
  93.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  94.             ],
  95.             'label'=>'Pays',
  96.         ])
  97.         ->add('phone'TelType::class,[
  98.             'required'=>true,
  99.             'attr'=>[
  100.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  101.             ],
  102.             'label_attr'=>[
  103.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  104.             ],
  105.             'label'=>'Telephone',
  106.         ])
  107.         ->add('email'EmailType::class,[
  108.             'required'=>true,
  109.             'attr'=>[
  110.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  111.             ],
  112.             'label_attr'=>[
  113.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  114.             ],
  115.             'label'=>'Email',
  116.         ])
  117.         ->add('pseudonym'TextType::class,[
  118.             'required'=>true,
  119.             'attr'=>[
  120.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  121.             ],
  122.             'label_attr'=>[
  123.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  124.             ],
  125.             'label'=>'Pseudo',
  126.         ])
  127.         ->add('plainPassword'PasswordType::class, [
  128.             // instead of being set onto the object directly,
  129.             // this is read and encoded in the controller
  130.             'mapped' => false,
  131.             'constraints' => [
  132.                 new NotBlank([
  133.                     'message' => 'Please enter a password',
  134.                 ]),
  135.                 new Length([
  136.                     'min' => 6,
  137.                     'minMessage' => 'Your password should be at least {{ limit }} characters',
  138.                     // max length allowed by Symfony for security reasons
  139.                     'max' => 4096,
  140.                 ]),
  141.             ],
  142.             'required'=>true,
  143.             'attr'=>[
  144.                 'class'=>'form-control col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 mb-1'
  145.             ],
  146.             'label_attr'=>[
  147.                 'class'=>'form-label col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12 text-left fontSize height'
  148.             ],
  149.             'label'=>'Mot de passe',
  150.         ])
  151.         ->add('agreeTerms'CheckboxType::class, [
  152.             'mapped' => false,
  153.             'constraints' => [
  154.                 new IsTrue([
  155.                     'message' => 'You should agree to our terms.',
  156.                 ]),
  157.             ],
  158.             'label'=> "J'accepte",
  159.             'label_attr'=>[
  160.                 'class' => 'form-label col-xl-11 col-lg-11 col-md-11 col-sm-11 col-11 text-center align-self-center',
  161.             ],
  162.             'attr'=>[
  163.                 'class'=>'form-check col-xl-1 col-lg-1 col-md-1 col-sm-1 col-1 align-self-center mb-1'
  164.             ],
  165.         ])
  166.         
  167.         ->add('compagny'CompagnyInfoType::class);
  168.         
  169.     }
  170.     public function configureOptions(OptionsResolver $resolver)
  171.     {
  172.         $resolver->setDefaults([
  173.             'data_class' => User::class,
  174.         ]);
  175.     }
  176. }