Skip to content

Commit fbab25e

Browse files
committed
Merge branch '2.2'
2 parents fa7d597 + 52670e5 commit fbab25e

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/Bridge/Symfony/Routing/CachedRouteNameResolver.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ public function __construct(CacheItemPoolInterface $cacheItemPool, RouteNameReso
3939
*/
4040
public function getRouteName(string $resourceClass, $operationType /**, array $context = []**/): string
4141
{
42-
$cacheKey = self::CACHE_KEY_PREFIX.md5(serialize([$resourceClass, $operationType]));
42+
$context = \func_num_args() > 2 ? func_get_arg(2) : [];
43+
$cacheKey = self::CACHE_KEY_PREFIX.md5(serialize([$resourceClass, $operationType, $context['subresource_resources'] ?? null]));
4344

4445
try {
4546
$cacheItem = $this->cacheItemPool->getItem($cacheKey);

src/EventListener/ReadListener.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ public function onKernelRequest(GetResponseEvent $event)
7070
$context = null === $filters ? [] : ['filters' => $filters];
7171
if ($this->serializerContextBuilder) {
7272
// Builtin data providers are able to use the serialization context to automatically add join clauses
73-
$context['normalization_context'] = $this->serializerContextBuilder->createFromRequest($request, true, $attributes);
74-
$request->attributes->set('_api_normalization_context', $context['normalization_context']);
73+
$context += $normalizationContext = $this->serializerContextBuilder->createFromRequest($request, true, $attributes);
74+
$request->attributes->set('_api_normalization_context', $normalizationContext);
7575
}
7676

7777
$data = [];

0 commit comments

Comments
 (0)