How to give container as argument to services
It’s easy, if service extends ContainerAware use \Symfony\Component\DependencyInjection\ContainerAware; class YouService extends ContainerAware { public function someMethod() { $this->container->get(‘router’)->generate(‘fos_user_profile_edit’) … } } service.yml your.service: class: App\…\YouService calls: – [ setContainer,[ @service_container ] ]