lithium\data\Model::update PHP 메소드

update() 공개 정적인 메소드

Update multiple records or documents with the given data, restricted by the given set of criteria (optional).
public static update ( mixed $data, mixed $conditions = [], array $options = [] ) : boolean
$data mixed 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.
$conditions mixed An array of key/value pairs representing the scope of the records to be updated.
$options array Any database-specific options to use when performing the operation. See the `delete()` method of the corresponding backend database for available options.
리턴 boolean Returns `true` if the update operation succeeded, otherwise `false`.
    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);
        });
    }