list display in choicEntity in symfony 5

I am not at all familiar with PHP, and still months with Symfony, I am developing a small project thanks to a tutorial and I have a problem that has blocked me for too long
veil: I have a choiceType on a form which must display a list that comes from an array passed in the parameters of the createForm

 public function buildForm (FormBuilderInterface $ builder, array $ options)
 {
     $ choices = $ options ['choices'];
     $ builder
         -> add ('month', ChoiceType :: class, [
             'choices' => $ choices,
       ]);
 }

my array

public function rt_liste(){
   $choice =['0'=>'11','1'=>'8','3'=>'9'];
   return $choice;
 }

So here it is, the list displays 0, 1, 2 ..etc, but I would like to see 11, 8, 9 …

thank you

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *