You are here

public function Resource::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/Resource.php, line 266
Contains \Drupal\restful\Plugin\resource\Resource.

Class

Resource

Namespace

Drupal\restful\Plugin\resource

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);
}