src/Form/RespondentType.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\Rank;
  4. use App\Entity\Respondent;
  5. use Symfony\Bridge\Doctrine\Form\Type\EntityType;
  6. use Symfony\Component\Form\AbstractType;
  7. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  8. use Symfony\Component\Form\FormBuilderInterface;;
  9. use Symfony\Component\OptionsResolver\OptionsResolver;
  10. class RespondentType extends AbstractType
  11. {
  12.     public function buildForm(FormBuilderInterface $builder, array $options): void
  13.     {
  14.         $builder
  15.             ->add('rank'EntityType::class, [
  16.                 'label' => 'Poste',
  17.                 'class' => Rank::class,
  18.                 'required' => true,
  19.                 'expanded' => false,
  20.                 'multiple' => false,
  21.             ])
  22.             ->add('alreadyTrained'ChoiceType::class, [
  23.                 'label' => "Avez-vous déjà suivi une formation management ?",
  24.                 'choices' => [
  25.                     'Non' => 0,
  26.                     'Oui' => 1
  27.                 ],
  28.                 'required' => true,
  29.                 'expanded' => true,
  30.                 'multiple' => false,
  31.                 'empty_data' => 0
  32.             ])
  33.         ;
  34.     }
  35.     public function configureOptions(OptionsResolver $resolver): void
  36.     {
  37.         $resolver->setDefaults([
  38.             'data_class' => Respondent::class,
  39.         ]);
  40.     }
  41. }