hi guys,

i have some trouble with checkboxes, boolean values and propel in the
current 1.1 svn branch.

if you have "required: true" in your schema.yml with a "type: boolean"
field, loading fixtures will set this field to 0 in the database
(mysql in my case, because it doesn't know boolean and uses int(1)
instead). then, sfWidgetFormInputCheckbox will render as checked,
because it only accepts null as a value for false. i think
sfWidgetFormInputCheckbox->render() should not check for "if(!
is_null($value))", but simply "if($value)". also propel should return
true or false on boolean fields, not just the content (which can be
null).

this would eliminate a second problem: if you have a field in the
database set to true (actually to int 1), if you set the property of
the propel object to to true (i.e. $object->setSomeBoolean(true)),
propel will issue a database update, altough the field is already
true. in the end, your object will end up as $object->isModified() ==
true. if you have a manage page for this object, and you want to know
if any changes happened, this is really annoying.

i currently fix this in two ways:
i do not set "required: true" on boolean fields
i overwrite all setSomeBoolean() methods to only setSomeBoolean(true)
if it was false before

am i wrong to think all this is a problem? sfWidgetForm changed
exactly this with r8487 :)

there is another problem with propel-objects and forms:
if you have a property of a propel-object as null in the database, and
you have a form, with each field corresponding to a property. if you
now submit this form with a form field left empty, it will result in
an unnecessary database update, where a field is updated from NULL to
the empty string. in the end, you will have "$object->isModified() ==
true" once more. currently, i unset empty strings in my parameter-
array before i do "$object->fromArray($params)", but again i have take
special care of checkboxes and intentional empty strings.

will there be a solution or am i wrong (again)? :)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to