Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
problem with checkboxes, boolean values and propel (sf1.1)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  1 message - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Axel Baumgartner  
View profile  
 More options May 5 2008, 11:50 am
From: Axel Baumgartner <ignoz...@gmail.com>
Date: Mon, 5 May 2008 08:50:32 -0700 (PDT)
Local: Mon, May 5 2008 11:50 am
Subject: problem with checkboxes, boolean values and propel (sf1.1)
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 must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »