I have form $form, which have text field for each entity User.
$form = $this->createFormBuilder();
$form->add('users', 'collection');
foreach ($query->getResult() as $user)
{
$form->get('users')->add($user->getName(), 'text', array('data' => $user->getName()));
}
I need to access specific input form by its ID number. So i have to be able to do something like this:
{{ form_widget(form.users[0]) }}
But it doesn’t work. I can’t use this:
{% for user in form.users %}
I need to access text fields specificly by their id’s
Found the solution.