/** * {@inheritdoc} * * @throws InvalidArgumentException */ public function denormalize($data, $class, $format = null, array $context = []) { // Avoid issues with proxies if we populated the object if (isset($data['id']) && !isset($context['object_to_populate'])) { if (isset($context['api_allow_update']) && true !== $context['api_allow_update']) { throw new InvalidArgumentException('Update is not allowed for this operation.'); } $context['object_to_populate'] = $this->iriConverter->getItemFromIri($data['id'], $context + ['fetch_data' => false]); } return parent::denormalize($data, $class, $format, $context); }