I'm creating a form in Symfony2. The form has a field which is mapped to an entity array like this:
$builder
->add('card', 'entity', array(
'class' => 'AppBundle:Card',
'property' => 'description',
'choices' => $choices
));
I load the $choices array in my Controller. If I create the Form using the FormBuilder in the Controller I can use easily set the choices option, but I'd like to keep it in its own class to avoid bloating the Controller. Is there a clean way to inject the $choices array when creating the form?