You are here

public function RestfulDataProviderDbQuery::remove in RESTful 7

Remove the item from the data source.

Parameters

mixed $id: The unique ID for the item.

Overrides RestfulBase::remove

File

plugins/restful/RestfulDataProviderDbQuery.php, line 518
Contains \RestfulDataProviderDbQuery

Class

RestfulDataProviderDbQuery
@file Contains \RestfulDataProviderDbQuery

Code

public function remove($id) {

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