tags:

views:

486

answers:

2

In short, I assume that the correct method of doing this would be an updateAll with the conditions being those of the real key. The problem lies in that updateAll doesn't by default prepare the new values for database insertion. I have seen some code demonstrating how to do the escaping properly, and would prefer to use this instead of doing a find to discover the primary key first per record. However, in my searching I have not found it yet.

+2  A: 

CakePHP does not support composite primary keys.

evilbloodydemon
A: 
$db =& ConnectionManager::getDataSource($this->useDbConfig);
foreach($fields as $key => $field) {
   $fields[$key] = $db->value($field);
}
return $db->update($this, $fields, null, $conditions);

Never did find the code though. It also involves saving in 2 for-loops, which is less than ideal - one loops through the form submits and calls this code (instead of updateAll or save), the other puts the cake magic filtering on each field to pass to the database.

michaelc