your syntax is incorrect, you should use this instead:
{{ form_widget(form.skills,{ value : allocation.skills.skillsId, 'attr': {'class': 'right skillClass', } }) }}
NOTE
value must be a string, so there are two ways you can achive this
- setting the default value in the form in your controller
- passing a string to the view
- "converting" the integer into a string in twig
setting the default value in the form in your controller
->add("skills", "choice", array("label" => "Skills", "choices" => $yourChoices, "attr" => array("class" => "right skillClass"), 'preferred_choices' => array(allocation.skills.skillsId)))
passing a string to the view
return $this->render("Bundle:view.html.twig", array("yourId" => (string)$yourId));
and the use yourId
into the twig
{{ form_widget(form.skills,{ value : yourId, 'attr': {'class': 'right skillClass', } }) }}
"converting" the integer into a string in twig (very dirty)
{{ form_widget(form.skills,{ value : "" ~ allocation.skills.skillsId ~ "", 'attr': {'class': 'right skillClass', } }) }}