I'm trying to use the Utils.SoftDelete plugin by CakeDC, and I'm
having strange errors upon save(). Long story short, the plugin
overrides the Cake library's Model.php delete() function to do a soft
delete (assert a field called "deleted" and set the "deleted_date").
I have a Photos model with MySQL table "photos" with columns
"deleted" ( type INT(1), default 0) and "deleted_date" (DATETIME,
default NULL). The save() function at the end of the
SoftDeleteHelper's delete() function is returning false; however, the
"deleted" field is set to 1, and the "deleted_date" is set to the
current DATETIME. The SQL query is also valid:
UPDATE photos SET deleted = '1', deleted_date = '2010-10-24 18:08:56',
modified = '2010-10-24 18:08:56' WHERE photos.id = 3
Why does the save() (which causes a false return from delete())
function return false? I could ignore this false negative, since it
is clearly saving properly, but then my code could never know when it
actually encounters trouble saving to the database.
I've traced the code execution all the way through and it seems to be
failing at this line in cake.lib.Model's save() function:
$db =& ConnectionManager::getDataSource($this->useDbConfig);
where $this->useDbConfig is equal to "default". The error handler then
goes to Cake's debugger.php:
function handleError($code, $description, $file = null, $line = null,
$context = null) {
if (error_reporting() == 0 || $code === 2048 || $code === 8192) {
return;
}
}
And $code is equal to 2048. Does this refer to mysql code 2048? I
looked that up and found it to be "Invalid connection handle".
Thanks in advance for any help anyone can provide!
Or, better yet, if you know of a working SoftDelete helper out there,
I'm more than willing to switch!
Best,
Jonathan
Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions.
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to
cake-php+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
No comments:
Post a Comment