I am working on this ticket: https://trac.cakephp.org/ticket/4190

Up to now I have been operating under the idea that if I am updating a
record, that it is not necessary to explicitly declare the values for
every column in the database row.

I figured that in the logic for Model::save() that it would check to
make sure that if any values are already set, that those values will
not get overwritten.

However, after doing a bit of investigating, it appears that my
assumption might be wrong.

According to my reading of the logic within the Model class, the
following happens:

-- if the column 'fieldname' has a default value in it's scheme, this
value is set in $this->data[ tablename ][ fieldname ]
-- if the $data array passed to either create() or save() does not
have an explicitly set value for $this->data[ tablename ]
[ fieldname ], then the default value will be entered EVEN IF A VALUE
CURRENTLY EXISTS.

Is this a bug?  Or is this how it is supposed to work?  Should we
always be using the controller to retrieve all values in a record
before sending that data array to the Model::save() function?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to