Actually I have a Project entity with a one-to-many relation on ProjectsWorkgroups entity which have a many-to-one relation on Workgroup entity. I would like to display many radio buttons and to be able to assign a Workgroup to the project.
I try that, without success
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('name');
$builder->add('color');
$builder->add('workgroups', 'entity', array(
'class' => 'MyBundle:Workgroup',
'property' => 'name',
'multiple' => true
));
}
What’s wrong?
Thanks in advance.
if you want a radio buttons you must change property multiple to false and expanded to true
like this:
for more details:
Select tag, Checkboxes or Radio Buttons