src/Form/EleveurType.php line 49

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Eleveur;
  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\Bridge\Doctrine\Form\Type\EntityType;
  11. use App\Entity\DicGouvernorat;
  12. use App\Entity\DicDelegation;
  13. use App\Entity\DicImada;
  14. use VictorPrdh\RecaptchaBundle\Form\ReCaptchaType;
  15. use Symfony\Component\Validator\Constraints\NotBlank;
  16. class EleveurType extends AbstractType
  17. {
  18.     public function buildForm(FormBuilderInterface $builder, array $options): void
  19.     {
  20.         $builder
  21.             ->add('nprElvAr'TextType::class, array('required' => false'attr' => array('class' => 'form-control form-control-line')))
  22.             ->add('nprElvFr'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  23.             ->add('typeElv'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  24.             ->add('identElv'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  25.             ->add('adresse'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  26.             ->add('numTel'TextType::class, array('required' => true'attr' => array('class' => 'form-control form-control-line')))
  27.             ->add('numFax'IntegerType::class, array('required' => false'attr' => array('class' => 'form-control form-control-line')))
  28.             ->add('gouvernorat'EntityType::class, [
  29.                 'class' => DicGouvernorat::class,
  30.                 'query_builder' => function (EntityRepository $er) {
  31.                     return $er->createQueryBuilder('g')
  32.                         ->orderBy('g.gouvernorat''ASC');
  33.                 },
  34.                 'choice_label' => 'gouvernorat',
  35.                 'required' => true'attr' => array('required' => 'required''class' => 'form-control')
  36.                 ])
  37.             ->add('delegation'EntityType::class, [
  38.                 'class' => DicDelegation::class,
  39.                 'query_builder' => function (EntityRepository $er) {
  40.                     return $er->createQueryBuilder('d')
  41.                         ->orderBy('d.delegation''ASC');
  42.                 },
  43.                 'choice_label' => 'delegation',
  44.                 'required' => true'attr' => array('required' => 'required''class' => 'form-control')
  45.                 ])
  46.             ->add('imada'EntityType::class, [
  47.                 'class' => DicImada::class,
  48.                 'query_builder' => function (EntityRepository $er) {
  49.                     return $er->createQueryBuilder('i')
  50.                         ->orderBy('i.nom''ASC');
  51.                 },
  52.                 'choice_label' => 'nom',
  53.                 'required' => true'attr' => array('required' => 'required''class' => 'form-control')
  54.                 ])
  55.                 ->add('recaptcha'ReCaptchaType::class,array('attr' => array('required' => 'required','data-sitekey' => '6LdCul0hAAAAAEU1_jBA92CxMT3-u7rJzsQRN7xW' )))
  56.                     
  57.         ;
  58.     }
  59.     public function configureOptions(OptionsResolver $resolver): void
  60.     {
  61.         $resolver->setDefaults([
  62.             'data_class' => Eleveur::class,
  63.         ]);
  64.     }
  65. }