Closed
Description
Description
With the deprecation of the session
service, I'm trying to figure out how to register custom attribute/flash bags (via SessionInterface::registerBag()
) in 5.3+.
I'm not sure if this is the best practice but the common way of doing this pre-5.3 seems to be a compiler pass with the following:
$container->getDefinition('session')
->addMethodCall('registerBag', [new Reference('my_custom_bag_service')])
;
I thought about a request listener to run right after the SessionListener
(to ensure the session isn't yet started) but that would trigger the Request::$session
callback perhaps unnecessarily...
If there is currently a better way that works in 5.3, I can add this to the docs.