Search code examples
phpformssymfonysymfony-2.7

Symfony2 - Set label of ChoiceType


I have a select field (choiceType) in a form which is automatically filled (with all the line in another table).

I would like to set the label (only the label, not the content of the select)...

I managed to do that for a textType with changing :

$builder->add('note')

to

$builder->add('note', 'text', array('label' => 'myNewLabel')

but I can't do that with a choiceType because if I change

$buidler->add('column')

to

$builder->add('column', 'choice', array('label' => 'myNewLabel')

the select isn't filled...


Solution

  • The solution is :

    $builder->add('column', null, array('label' => 'myNewLabel')