lithium\data\Model::remove()

public static method

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

boolean

Returns true if the remove operation succeeded, otherwise false.

Filter

This method can be filtered.

Source

	public static function remove($conditions = [], array $options = []) {
		$params = compact('conditions', 'options');

		return Filters::run(get_called_class(), __FUNCTION__, $params, function($params) {
			$options = $params['options'] + $params + [
				'model' => get_called_class(),
				'type' => 'delete'
			];
			unset($options['options']);

			$query = static::_instance('query', $options);
			return static::connection()->delete($query, $options);
		});
	}