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) {