You are here

protected function DataProviderEntity::validateBody in RESTful 7.2

Validates the body payload object for entities.

Parameters

mixed $body: The parsed body.

Throws

\Drupal\restful\Exception\BadRequestException For the empty body.

2 calls to DataProviderEntity::validateBody()
DataProviderEntity::create in src/Plugin/resource/DataProvider/DataProviderEntity.php
Create operation.
DataProviderEntity::update in src/Plugin/resource/DataProvider/DataProviderEntity.php
Update operation.

File

src/Plugin/resource/DataProvider/DataProviderEntity.php, line 1069
Contains \Drupal\restful\Plugin\resource\DataProvider\DataProviderEntity.

Class

DataProviderEntity
Class DataProviderEntity.

Namespace

Drupal\restful\Plugin\resource\DataProvider

Code

protected function validateBody($body) {
  if (isset($body) && !is_array($body)) {
    $message = sprintf('Incorrect object parsed: %s', print_r($body, TRUE));
    throw new BadRequestException($message);
  }
}