You are here

public function ResourceDecoratorBase::doPut in RESTful 7.2

Shorthand method to perform a quick PUT 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::doPut

File

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

Class

ResourceDecoratorBase
Class ResourceDecoratorBase.

Namespace

Drupal\restful\Plugin\resource\Decorators

Code

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