src/Form/PrixType.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Form;
  3. use App\Entity\PrixVariable;
  4. use Symfony\Component\Form\AbstractType;
  5. use Symfony\Component\Form\FormBuilderInterface;
  6. use Symfony\Component\OptionsResolver\OptionsResolver;
  7. use Symfony\Component\Form\Extension\Core\Type\ChoiceType;
  8. class PrixType extends AbstractType
  9. {
  10.     public function buildForm(FormBuilderInterface $builder, array $options): void
  11.     {
  12.         $builder
  13.             ->add('Name')
  14.             ->add('Prix')
  15.             ->add('Category'ChoiceType::class, [
  16.                 'choices'  => [
  17.                     'Adhérent' => "Adhérent",
  18.                     'Etudiant' => "Etudiant",
  19.                     'Other' => "Other",
  20.                  ],
  21.                 ]);
  22.     }
  23.     public function configureOptions(OptionsResolver $resolver): void
  24.     {
  25.         $resolver->setDefaults([
  26.             'data_class' => PrixVariable::class,
  27.         ]);
  28.     }
  29. }