diff --git a/core/modules/serialization/src/Normalizer/NormalizerBase.php b/core/modules/serialization/src/Normalizer/NormalizerBase.php index 31e2402851..e960cc9acb 100644 --- a/core/modules/serialization/src/Normalizer/NormalizerBase.php +++ b/core/modules/serialization/src/Normalizer/NormalizerBase.php @@ -2,7 +2,6 @@ namespace Drupal\serialization\Normalizer; -use Drupal\Core\Cache\CacheableDependencyInterface; use Symfony\Component\Serializer\Normalizer\SerializerAwareNormalizer; /** @@ -90,8 +89,8 @@ protected function checkFormat($format = NULL) { * The data that might have cacheability information. */ protected function addCacheableDependency(array $context, $data) { - if ($data instanceof CacheableDependencyInterface && isset($context[CacheableDependencyInterface::SERIALIZATION_CONTEXT_CACHEABILITY])) { - $context[CacheableDependencyInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($data); + if ($data instanceof CacheableNormalizerInterface && isset($context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY])) { + $context[CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY]->addCacheableDependency($data); } }