/** * @param Request $request * @param ResourceInterface $resource * * @return object * * @throws DeserializationException */ protected function getEntity(Request $request, ResourceInterface $resource) { try { $object = $this->get('api.json_ld.normalizer.item')->denormalize($request->getContent(), $resource->getEntityClass(), 'json-ld', $resource->getDenormalizationContext()); } catch (\Exception $e) { throw new DeserializationException($e->getMessage(), $e->getCode(), $e); } return $object; }