symfony/symfony — pull request #2580 by Burgov (2011-11-08 13:45:45+00:00)
Title: Support for callable in EntityChoiceList

Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: yes
Fixes the following tickets: -

Allow for a callable to be supplied as argument to EntityChoiceList, to provide for more flexibility in displaying the listbox.

E.g.:

$builder->add('field', 'entity', array(
'class' => 'FooBundle:Foo',
'property' => function(Foo $foo) {
return sprintf("%s (%s)", $foo->getName(), $foo->getCategory());
}
));