You are here

public function DataProviderDbQuery::remove in RESTful 7.2

Delete operation.

Parameters

mixed $identifier: The ID of thing to be removed.

Overrides CrudInterface::remove

File

src/Plugin/resource/DataProvider/DataProviderDbQuery.php, line 340
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderDbQuery.

Class

DataProviderDbQuery

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

public function remove($identifier) {

  // If it's a delete method we will want a 204 response code.
  // Set the HTTP headers.
  $this
    ->setHttpHeader('Status', 204);
  $query = db_delete($this
    ->getTableName());
  foreach ($this
    ->getIdColumn() as $index => $column) {
    $query
      ->condition($column, current($this
      ->getColumnFromIds(array(
      $identifier,
    ), $index)));
  }
  $query
    ->execute();
}