Using Doctrine in symfony 1.4 I have several boolean columns defined (stored as a tinyint in mySQL). The checkbox widgets are always rendering as checked, even when the returned value is ‘0’. It seems related to this ticket.
Is this a common problem? Is there a workaround?
I can get it working by changing line 70 in sfWidgetFormInputCheckbox to:
if (null !== $value && $value !== false && $value !== 0)
but I’d rather not alter core symfony files.
Symfony unresolved bug, see http://www.devexp.eu/2009/04/23/sfwidgetforminputcheckbox-unchecked-bug/
Your database returns a 0 for a unchecked box but Symfony renders it as checked.
You can patch yourself by editing symfony/lib/widget/sfwidgetforminputcheckbox.class, line 70 (in version 1.4.6), change:
if (null !== $value && $value !== false)in
if (null !== $value && $value !== false && $value != 0)