Optimization to Model::save().

This commit is contained in:
Joël Perras 2010-01-14 12:57:43 -05:00
parent c196c2cbdf
commit 137704e397

View file

@ -1393,7 +1393,7 @@ class Model extends Overloadable {
}
if (!empty($joined) && $success === true) {
$this->__saveMulti($joined, $this->id);
$this->__saveMulti($joined, $this->id, $db);
}
if ($success && $count > 0) {
@ -1423,9 +1423,7 @@ class Model extends Overloadable {
* @param mixed $id ID of record in this model
* @access private
*/
function __saveMulti($joined, $id) {
$db =& ConnectionManager::getDataSource($this->useDbConfig);
function __saveMulti($joined, $id, &$db) {
foreach ($joined as $assoc => $data) {
if (isset($this->hasAndBelongsToMany[$assoc])) {