A
A
Alexey Alekseev2019-02-02 10:24:05
symfony
Alexey Alekseev, 2019-02-02 10:24:05

How to add data to select from controller in Symfony?

I create an empty select using a builder:
$builder->add('myselect', ChoiceType::class, array(
'label' => 'My select',
'required' => false
))
How can I add data (choices) to it from the controller, i.e. add option?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
padlyuck, 2019-02-02
@padlyuck

https://symfony.com/doc/current/reference/forms/ty...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question