diff --git a/src/Serializer/ItemNormalizer.php b/src/Serializer/ItemNormalizer.php index 36bb1799f1d..687acb5ceee 100644 --- a/src/Serializer/ItemNormalizer.php +++ b/src/Serializer/ItemNormalizer.php @@ -32,7 +32,7 @@ class ItemNormalizer extends AbstractItemNormalizer public function denormalize($data, $class, $format = null, array $context = []) { // Avoid issues with proxies if we populated the object - if (isset($data['id']) && !isset($context[self::OBJECT_TO_POPULATE])) { + if (isset($data['id']) && !isset($context[self::OBJECT_TO_POPULATE]) && isset($context['resource_class'])) { if (isset($context['api_allow_update']) && true !== $context['api_allow_update']) { throw new InvalidArgumentException('Update is not allowed for this operation.'); }