avoiding container strings in dependency injection in symfony avoiding container strings in dependency injection in symfony symfony symfony

avoiding container strings in dependency injection in symfony


If you're requesting the service from a controller, you can setup your controller to be a service too. Then you can pass the employee repository service to it using dependency injection.

That way you will not have the string reference in the controller, but in the configuration.

http://symfony.com/doc/current/cookbook/controller/service.html