```$this->getLegacyKernel()``` is available already on your controller (a controller extending eZ\Bundle\EzPublishCoreBundle\Controller) so your method is useless sorry :)