protected function deserialize(RouteMatchInterface
$route_match, Request
$request, ResourceInterface
$resource) { // Deserialize incoming data if available.
$received =
$request->
getContent();
$unserialized = NULL;
if (!
empty($received)) { $method =
static::
getNormalizedRequestMethod($route_match);
$format =
$request->
getContentTypeFormat();
$definition =
$resource->
getPluginDefinition();
// First decode the request data. We can then determine if the
// serialized data was malformed.
try { $unserialized =
$this->serializer->
decode($received,
$format,
['request_method' =>
$method]);
} catch (UnexpectedValueException
$e) { // If an exception was thrown at this stage, there was a problem