You are here

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

Class

Resource

Namespace

Drupal\restful\Plugin\resource

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