lithium\data\Model::remove()
Remove multiple documents or records based on a given set of criteria. WARNING: If no
criteria are specified, or if the criteria ($conditions
) is an empty value (i.e. an empty
array or null
), all the data in the backend data source (i.e. table or collection) will
be deleted.
Parameters
-
mixed
$conditions
An array of key/value pairs representing the scope of the records or documents to be deleted.
-
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
booleanReturns true
if the remove operation succeeded, otherwise false
.
Filter
This method can be filtered.
Source
public static function remove($conditions = array(), array $options = array()) {
$params = compact('conditions', 'options');
return static::_filter(__FUNCTION__, $params, function($self, $params) {
$options = $params['options'] + $params + array('model' => $self, 'type' => 'delete');
unset($options['options']);
$query = $self::invokeMethod('_instance', array('query', $options));
return $self::connection()->delete($query, $options);
});
}