You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a private library for handling translations, which works in a way where you have a translatable entity and a collection of translation entities for it, each for a different locale. Each time the translatable entity is being created or modified via Doctrine's Unit of Work, the current locale is being checked and either a new translation is created or an existing one is modified. The locale is checked like so, through a dedicated service:
The library worked just fine until I switched from accessing the session service directly from the container to accessing the instance from the request_stack, as seen above. Basically, $this->requestStack->getCurrentRequest() (or any other of it's methods) never returns an actual request. From analyzing the code it seems that there is a RequestStack being created in the HttpKernel used by Symfony module, but from what I have checked it is not the same instance that gets injected into my LocaleProvider service. Is there anything that I am missing here?
The text was updated successfully, but these errors were encountered:
szymach
changed the title
Getting session storage to work between requests
Accessing session from request stack
Dec 24, 2021
Hello,
I have a private library for handling translations, which works in a way where you have a translatable entity and a collection of translation entities for it, each for a different locale. Each time the translatable entity is being created or modified via Doctrine's Unit of Work, the current locale is being checked and either a new translation is created or an existing one is modified. The locale is checked like so, through a dedicated service:
The library worked just fine until I switched from accessing the
session
service directly from the container to accessing the instance from therequest_stack
, as seen above. Basically,$this->requestStack->getCurrentRequest()
(or any other of it's methods) never returns an actual request. From analyzing the code it seems that there is aRequestStack
being created in theHttpKernel
used by Symfony module, but from what I have checked it is not the same instance that gets injected into myLocaleProvider
service. Is there anything that I am missing here?The text was updated successfully, but these errors were encountered: