You are here

public function ResourceDecoratorBase::doDelete in RESTful 7.2

Shorthand method to perform a quick DELETE request.

Parameters

string $path: The resource path.

Throws

\Drupal\restful\Exception\BadRequestException When the path is not present.

Overrides ResourceInterface::doDelete

File

src/Plugin/resource/Decorators/ResourceDecoratorBase.php, line 378
Contains \Drupal\restful\Plugin\resource\Decorators\ResourceDecoratorBase.

Class

ResourceDecoratorBase
Class ResourceDecoratorBase.

Namespace

Drupal\restful\Plugin\resource\Decorators

Code

public function doDelete($path) {
  if (!$path) {
    throw new BadRequestException('DELETE requires a path. None given.');
  }
  $this
    ->setPath($path);
  $this
    ->setRequest(Request::create($this
    ->versionedUrl($path, array(
    'absolute' => FALSE,
  )), array(), RequestInterface::METHOD_DELETE));
  return $this
    ->process();
}