samedi 2 juillet 2016

Render a Checkbox in Twig; Boolean expected error

I'm trying to render a checkbox inside a form but got the next error:

TransformationFailedException in Form.php line 1149: Unable to transform value for property path "[active]": Expected a Boolean.

Yes, what I send is an integer 0 or 1, but twig get them as string and it has sense but I really can't find how to render the checkbox.

This is the controller:

    $form = $form->add('active', 'checkbox', array('label' => 'User active?','required' => false));

And this is the Twig side:

) }}

Any idea?




Aucun commentaire:

Enregistrer un commentaire