From 43b6eaed5eb743be89c9fd121be676dc60d76ba7 Mon Sep 17 00:00:00 2001 From: Joel Wurtz Date: Thu, 7 Jun 2018 11:06:37 +0200 Subject: [PATCH] Deactivate ItemNormalizer when not in ApiPlatform context --- src/Serializer/ItemNormalizer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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.'); }