I have a JSON
file with all world languages and would like to put them into choices array inside ChoiceType
form field.
$builder->add('languages', ChoiceType::class, array(
'choices' => array()
))
My JSON
file is stored: projectname/web/bundles/index/json/languages.json
Is it possible to achieve it without writing JS
/ AJAX
?
P.S. EventListeners
or other alternatives that Symfony2
provides suits me well.
You could reach the file with DIR, since I dont' know where the php file with builder is located, it could looks like: