From 383fd797a3416e1dee57c6bcd8e6b97a093073f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 29 Jan 2023 13:06:21 +0100 Subject: [PATCH] Use current request instead of main request. --- src/Services/UserSystem/UserCacheKeyGenerator.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Services/UserSystem/UserCacheKeyGenerator.php b/src/Services/UserSystem/UserCacheKeyGenerator.php index 875e0539..c7c9e737 100644 --- a/src/Services/UserSystem/UserCacheKeyGenerator.php +++ b/src/Services/UserSystem/UserCacheKeyGenerator.php @@ -49,9 +49,9 @@ class UserCacheKeyGenerator */ public function generateKey(?User $user = null): string { - $main_request = $this->requestStack->getMainRequest(); + $request = $this->requestStack->getCurrentRequest(); //Retrieve the locale from the request, if possible, otherwise use the default locale - $locale = $main_request ? $main_request->getLocale() : Locale::getDefault(); + $locale = $request ? $request->getLocale() : Locale::getDefault(); //If no user was specified, use the currently used one. if (null === $user) {