Responds to entity DELETE requests.
mixed $id: The entity ID.
\Drupal\rest\ResourceResponse The HTTP response object.
\Symfony\Component\HttpKernel\Exception\HttpException
public function delete($id) {
  $definition = $this
    ->getDefinition();
  $entity = entity_load($definition['entity_type'], $id);
  if ($entity) {
    try {
      $entity
        ->delete();
      // Delete responses have an empty body.
      return new ResourceResponse(NULL, 204);
    } catch (EntityStorageException $e) {
      throw new HttpException(500, 'Internal Server Error', $e);
    }
  }
  throw new NotFoundHttpException(t('Entity with ID @id not found', array(
    '@id' => $id,
  )));
}