src/Form/RecruiterFormType.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\User;
  4. use App\Entity\Ville;
  5. use Symfony\Component\Form\AbstractType;
  6. use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
  7. use Symfony\Component\Form\Extension\Core\Type\PasswordType;
  8. use Symfony\Component\Form\Extension\Core\Type\TextareaType;
  9. use Symfony\Component\Form\FormBuilderInterface;
  10. use Symfony\Component\OptionsResolver\OptionsResolver;
  11. use Symfony\Component\Validator\Constraints\IsTrue;
  12. use Symfony\Component\Validator\Constraints\Length;
  13. use Symfony\Component\Validator\Constraints\NotBlank;
  14. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  15. use Symfony\Component\Form\Extension\Core\Type\DateType;
  16. use Symfony\Component\Form\Extension\Core\Type\TelType;
  17. use Symfony\Component\Form\Extension\Core\Type\TextType;
  18. use Symfony\Component\Validator\Constraints\File;
  19. use Symfony\Component\Form\Extension\Core\Type\FileType;
  20. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  21. use App\Form\ExperienceType;
  22. use Symfony\Component\Form\Extension\Core\Type\BirthdayType;
  23. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  24. use Symfony\Component\Form\Extension\Core\Type\NumberType;
  25. use Symfony\Component\Form\Extension\Core\Type\RepeatedType;
  26. use Symfony\Component\Validator\Constraints\Image;
  27. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  28. use Symfony\Component\Form\Extension\Core\Type\SubmitType;
  29. class RecruiterFormType extends AbstractType
  30. {
  31.     public function buildForm(FormBuilderInterface $builder, array $options)
  32.     {
  33.         $builder
  34.             ->add('username'TextType::class, [
  35.                 'label' => "Nom"
  36.             ])
  37.             ->add('lastname'TextType::class, [
  38.                 'label' => "Prénom"
  39.             ])
  40.             ->add('email'EmailType::class, [
  41.                 'label' => "Email"
  42.             ])
  43.             ->add('password'PasswordType::class, [
  44.                 'label' => "Mot de passe"
  45.             ])
  46.             ->add('confirm_password',  PasswordType::class, [
  47.                 'label' => "Confirm mot de passe"
  48.             ])
  49.             ->add('phone'NumberType::class, [
  50.                 'label' => "Télèphone"
  51.             ])
  52.             ->add('sexe'ChoiceType::class, [
  53.                 'choices'  => [
  54.                     'Masculin' => 'masculin',
  55.                     'Féminin' => 'feminin'
  56.                 ],
  57.                 'mapped' => false,
  58.                 'label' => 'Genre'
  59.             ])
  60.             ->add('address'TextType::class)
  61.             ->add('ville'TextType::class, [
  62.                 'label' => 'Ville'
  63.             ])
  64.             ->add('naissance'BirthdayType::class, [
  65.                 'widget' => 'single_text',
  66.                 'label' => 'Date de naissance',
  67.                 'format' => 'yyyy-MM-dd',
  68.                 'attr' => [
  69.                     'class' => 'form-control'
  70.                 ]
  71.             ])
  72.             ->add('etablissement')
  73.             ->add('logo'FileType::class, [
  74.                 'mapped' => false,
  75.                 'required' => false,
  76.                 'constraints' => [
  77.                     new Image([
  78.                         'maxSize' => '10M'
  79.                     ])
  80.                 ]
  81.             ])
  82.             ->add('a_propos',TextareaType::class)
  83.             ->add('matricule'TextType::class, [])
  84.             ->add('Submit'SubmitType::class,['label' =>'Valider']);
  85.     }
  86.     public function configureOptions(OptionsResolver $resolver)
  87.     {
  88.         $resolver->setDefaults([
  89.             'data_class' => User::class,
  90.         ]);
  91.     }
  92. }