Is there a way to access the kernel from inside a compiler pass? I’ve tried this:
...
public function process(ContainerBuilder $container)
{
$kernel = $container->get('kernel');
}
...
This throws an error. Is there another way to do it?
As far as I can tell, Kernel isn’t available anywhere in a CompilerPass, by default.
But you can add it in by doing this:
In your AppKernel, pass $this to the bundle the compiler pass is in.