Reputation: 5926
I am trying to update Symfony to the 2.7 API for choiceList. The symfony manual has the example:
$builder->add('isAttending', ChoiceType::class, array(
Which for php 5.4 I translated to
$builder->add('graduatedSince', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
However, I get a "Could not load type" error. What is the syntax?
Upvotes: 1
Views: 340
Reputation: 423
The syntax for Symfony 2.7 is
$builder->add('isAttending', 'choice', array(
'choices' => array(
'Maybe' => null,
'Yes' => true,
'No' => false,
),
// *this line is important*
'choices_as_values' => true,
));
Here is the documentation
Upvotes: 2