Build a form having a checkbox for each entity in a doctrine collection

I think this will answer your question. Forget the FooEntitySelectionType. Add a property_path field option to FooEntitySelectByIdentityType and set the data_class option to null: class FooEntitySelectByIdentityType extends AbstractType { public function buildForm(FormBuilderInterface $builder, array $options) { $builder->add(‘foo_id’, ‘entity’, array( ‘required’ => false, ‘class’ => ‘MeMyBundle:FooEntity’, ‘property’ => ‘id’, ‘property_path’ => ‘[id]’, # in square brackets! … Read more

Symfony2 Setting a default choice field selection

You can define the default value from the ‘data’ attribute. This is part of the Abstract “field” type (http://symfony.com/doc/2.0/reference/forms/types/field.html) $form = $this->createFormBuilder() ->add(‘status’, ‘choice’, array( ‘choices’ => array( 0 => ‘Published’, 1 => ‘Draft’ ), ‘data’ => 1 )) ->getForm(); In this example, ‘Draft’ would be set as the default selected value.