public function update(Model $Model, $fields = array(), $values = null, $conditions = null)
{
if (!$values) {
$combined = $fields;
} else {
$combined = array_combine($fields, $values);
}
$fields = implode(', ', $this->_prepareUpdateFields($Model, $combined, empty($conditions)));
$alias = $joins = null;
$table = $this->fullTableName($Model);
$conditions = $this->_matchRecords($Model, $conditions);
if ($conditions === false) {
return false;
}
$query = compact('table', 'alias', 'joins', 'fields', 'conditions');
if (!$this->execute($this->renderStatement('update', $query))) {
$Model->onError();
return false;
}
return true;
}