Access to Symfony Kernel For Integrating Old Files
I found this little tidbit that's worth sharing.
If you are integrating legacy code that doesn't follow the Symfony style, especially for dependency injection, you may find that you need access to the container. Perhaps you need something from the session object or the current request.
When Symfony starts, it creates a global variable called
kernel. Take hold of that variable and you will have access to the Symfony kernel, then call
Now use the container to get the session object.
I realize this breaks all of the OOP benefits that Symfony offers but offers a way to get data in the container to legacy code easily.