I figured it out, it's the set-method of the model class that does the
following:
if ($v !== null && !is_int($v) && is_numeric($v)) { $v = (int) $v; }
If it receives an empty value (int) $v will return 0. I added this and
everything works:
if ( $v == 0 ) { $v = null; }
On Jul 26, 4:33 pm, Kiri
So is your problem that the admin generator saves a '0' in the database
or because if you leave the field empty the validator YML files you have
set does not let you save you form because sfNumberValidator returns '0'
as an error input?
If it is the first case then you can overwrite the save()
Is 0 the default value for the field in your database ?
Daniel Staver wrote:
> When I leave an integer field blank in a form generated by the admin
> generator the actual value stored in the database is 0.
>
> However, this breaks validation with the sfNumberValidator as the
> permitted values fo
No, there is no default value in the database. If I store directly to
the database without using the admin generator and without specifying
a value for the field I get the correct behaviour, no value is stored.
If I save through the admin generator without specifying a value, 0 is
stored.
On Jul