Closed devnix closed 1 year ago
I have not really an idea But perhaps you may post here https://github.com/symfony/symfony/discussions or ask on symfony slack community support :)
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
Friendly ping? Should this still be open? I will close if I don't hear anything.
Hey,
I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!
Hello! I'm maintaining a big ol' legacy application while I'm slowly migrating it to a hexagonal architecture and Symfony, using this approach: https://symfony.com/doc/current/migration.html#front-controller-with-legacy-bridge
I'm slowly migrating all usages in
$_SESSION
in my legacy app to a custom service, so I can later rewrite my service from$_SESSION
and start using Symfony's session component.The problem I'm finding is that in this service I'm injecting
SessionInterface
. Reading the blog post about the session service deprecation in 5.3, I'm understanding that I should receive aRequestStack
instance instead.Under this strategy, as I understand, the legacy app will run after (or before)
$kernel->handle($request)
, so in legacy,$requestStack->getCurrentRequest()
will always return null, and$requestStack->getSession()
will always throw aSymfony\Component\HttpFoundation\Exception\SessionNotFoundException
.How should this be managed? I did not embed the application inside a legacy controller because of how globals breaks the application here and there.
Maybe could be a good practice to have an event listener saving the session instance of the main request, and accessing to that custom service from legacy? I could try to contribute to the documentation with an example if you consider it a recommended option. If not, maybe I should rush the deletion of the remaining globals, but that's a risky move and I would like to put all the options in balance.
P.S. I was not sure if this could be an issue for this repo, but I felt it was related to this part of the documentation. Please let me know if I should close the issue and open it again anywhere, thank you!