Extends
lithium\core\StaticObject
Update multiple records or documents with the given data, restricted by the given set of
criteria (optional).
Parameters
- mixed $data Typically 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 `SET` clause of an `UPDATE` query.
- mixed $conditions An array of key/value pairs representing the scope of the records to be updated.
- array $options Any database-specific options to use when performing the operation. See the `delete()` method of the corresponding backend database for available options.
Returns
boolean Returns `true` if the update operation succeeded, otherwise `false`.Source
public static function update($data, $conditions = array(), array $options = array()) {
$params = compact('data', 'conditions', 'options');
return static::_filter(__FUNCTION__, $params, function($self, $params) {
$options = $params + $params['options'] + array('model' => $self, 'type' => 'update');
unset($options['options']);
$query = $self::invokeMethod('_instance', array('query', $options));
return $self::connection()->update($query, $options);
});
}