For better integration between 5.x (symfony based) kernel and legacy (4.x) kernel, injection is used to inject settings, session and current siteaccess from 5.x into legacy using an event: kernel.event_subscriber
This page describe how you can do that.
Adding a kernel.event_subscriber
A legacy kernel event subscriber is added by tagging your event subscriber service.
Bellow is an example of yml configuration involved:
The class refered to as %my_app.legacy_mapper.something.class% can look like this: