<?php
namespace App\Form;
use App\Entity\Rank;
use App\Entity\Respondent;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
use Symfony\Component\Form\FormBuilderInterface;;
use Symfony\Component\OptionsResolver\OptionsResolver;
class RespondentType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options): void
{
$builder
->add('rank', EntityType::class, [
'label' => 'Poste',
'class' => Rank::class,
'required' => true,
'expanded' => false,
'multiple' => false,
])
->add('alreadyTrained', ChoiceType::class, [
'label' => "Avez-vous déjà suivi une formation management ?",
'choices' => [
'Non' => 0,
'Oui' => 1
],
'required' => true,
'expanded' => true,
'multiple' => false,
'empty_data' => 0
])
;
}
public function configureOptions(OptionsResolver $resolver): void
{
$resolver->setDefaults([
'data_class' => Respondent::class,
]);
}
}