Skip to content

Commit

Permalink
[Serializer] Use default context EXCLUDE_FROM_CACHE_KEY for unsetting…
Browse files Browse the repository at this point in the history
… OBJECT_TO_POPULATE
  • Loading branch information
alanpoulain authored and nicolas-grekas committed Sep 2, 2020
1 parent 52719f2 commit 8d9a1b6
Showing 1 changed file with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public function __construct(ClassMetadataFactoryInterface $classMetadataFactory
throw new InvalidArgumentException(sprintf('The "%s" given in the default context is not callable.', self::MAX_DEPTH_HANDLER));
}

$this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] = array_merge($this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] ?? [], [self::CIRCULAR_REFERENCE_LIMIT_COUNTERS]);
$this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] = array_merge($this->defaultContext[self::EXCLUDE_FROM_CACHE_KEY] ?? [], [self::CIRCULAR_REFERENCE_LIMIT_COUNTERS, self::OBJECT_TO_POPULATE]);

$this->propertyTypeExtractor = $propertyTypeExtractor;

Expand Down Expand Up @@ -618,7 +618,6 @@ private function getCacheKey(?string $format, array $context)
unset($context[$key]);
}
unset($context[self::EXCLUDE_FROM_CACHE_KEY]);
unset($context[self::OBJECT_TO_POPULATE]);
unset($context['cache_key']); // avoid artificially different keys

try {
Expand Down

0 comments on commit 8d9a1b6

Please sign in to comment.