Use current request instead of main request.

This commit is contained in:
Jan Böhmer 2023-01-29 13:06:21 +01:00
parent beeadef853
commit 383fd797a3

View file

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