lithium\data\Model::update()

public static method

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.

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 = Libraries::instance(null, 'query', $options, static::object()->_classes);
			return static::connection()->update($query, $options);
		});
	}