I followed @bentidy answer in a previous post pointed here by @Squazic. It's pretty simple
So for me, as I want both sex checkbox to be checked by default, I had to add the data argument as an array (it accepts both a single value and an array).
It goes like this :
//[...]
class ActivityFilterType extends AbstractType
{
//[...]
public function buildForm(FormBuilder $builder, array $options)
{
$builder->add('filter_checkbox', 'choice', array(
'label' => $this->translator->trans('form.label.sexFilter'),
'choices' => array(1 => ucfirst($this->translator->transChoice('sex.female', 2)), 2 => ucfirst($this->translator->transChoice('sex.male', 2))),
'multiple' => true,
'expanded' => true,
'required' => false,
'empty_value' => false,
'data' => array(1,2) // female value is 1 and male value is 2
));
}
//[...]
}
Here is the related doc : http://symfony.com/doc/2.0/reference/forms/types/field.html
Thanks Guys