You are here

public function ResourceDecoratorBase::doPatch in RESTful 7.2

Shorthand method to perform a quick PATCH request.

Parameters

string $path: The resource path.

array $parsed_body: The parsed body.

Return value

array The array ready for the formatter.

Throws

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

Overrides ResourceInterface::doPatch

File

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

Class

ResourceDecoratorBase
Class ResourceDecoratorBase.

Namespace

Drupal\restful\Plugin\resource\Decorators

Code

public function doPatch($path, array $parsed_body) {
  if (!$path) {
    throw new BadRequestException('PATCH requires a path. None given.');
  }
  return $this
    ->doWrite(RequestInterface::METHOD_PATCH, $path, $parsed_body);
}