lithium\data\Model::update()
Update multiple records or documents with the given data, restricted by the given set of criteria (optional).
Parameters
-
mixed
$dataTypically an array of key/value pairs that specify the new data with which the records will be updated. For SQL databases, this can optionally be an SQL fragment representing the
SETclause of anUPDATEquery. -
mixed
$conditionsAn array of key/value pairs representing the scope of the records to be updated.
-
array
$optionsAny database-specific options to use when performing the operation. See the
delete()method of the corresponding backend database for available options.
Returns
booleanReturns true if the update operation succeeded, otherwise false.
Filter
This method can be filtered.
Source
public static function update($data, $conditions = [], array $options = []) {
$params = compact('data', 'conditions', 'options');
return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
$options = $params + $params['options'] + [
'model' => get_called_class(),
'type' => 'update'
];
unset($options['options']);
$query = static::_instance('query', $options);
return static::connection()->update($query, $options);
});
}