lithium\data\Model::delete()

public method

Deletes the data associated with the current Model.

Parameters

  • object $entity

    Entity to delete.

  • array $options

    Options.

Returns

boolean

Success.

Filter

Good for executing logic for i.e. invalidating cached results.

Source

	public function delete($entity, array $options = []) {
		$params = compact('entity', 'options');

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

			$query = Libraries::instance(null, 'query', $options, static::object()->_classes);
			return static::connection()->delete($query, $options);
		});
	}