src/Form/DemandeFormationType.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\DemandeFormation;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Doctrine\ORM\EntityRepository;
  8. use Symfony\Component\Form\Extension\Core\Type\TextType;
  9. use Symfony\Component\Form\Extension\Core\Type\IntegerType;
  10. use Symfony\Component\Form\Extension\Core\Type\EmailType;
  11. use Symfony\Component\Form\Extension\Core\Type\CollectionType;
  12. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  13. use App\Entity\DicGouvernorat;
  14. use VictorPrdh\RecaptchaBundle\Form\ReCaptchaType;
  15. class DemandeFormationType extends AbstractType
  16. {
  17.     public function buildForm(FormBuilderInterface $builder, array $options): void
  18.     {
  19.         $builder
  20.             ->add('typeFormation'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  21.             ->add('identElv'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  22.             ->add('nprElvLt'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  23.             ->add('nprElvLi'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  24.             ->add('cin'IntegerType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  25.             ->add('niveauEducation'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  26.             ->add('adresse'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  27.             ->add('numTel'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  28.             ->add('email'EmailType::class, array('invalid_message' => 'VĂ©rifier votre email SVP''required' => true'attr' => array('required' => 'required''class' => 'form-control''placeholder'=>'Email')))
  29.             ->add('recaptcha'ReCaptchaType::class,array('attr' => array('required' => 'required')))
  30.             ->add('docDiplomes'CollectionType::class,[
  31.                 'entry_type' => DocDiplomeType::class,
  32.                 'entry_options' => ['label' => false],
  33.                 'allow_add' => true,
  34.                 'allow_delete' => true,
  35.             ])
  36.             ->add('gouvernorat'EntityType::class, [
  37.                 'class' => DicGouvernorat::class,
  38.                 'query_builder' => function (EntityRepository $er) {
  39.                     return $er->createQueryBuilder('g')
  40.                         ->orderBy('g.gouvernorat''ASC');
  41.                 },
  42.                 'choice_label' => 'gouvernorat',
  43.                 'required' => true'attr' => array('required' => 'required''class' => 'form-control')
  44.                 ])
  45.         ;
  46.     }
  47.     public function configureOptions(OptionsResolver $resolver): void
  48.     {
  49.         $resolver->setDefaults([
  50.             'data_class' => DemandeFormation::class,
  51.         ]);
  52.     }
  53. }