Symfony service injection syntax Symfony service injection syntax symfony symfony

Symfony service injection syntax


The equal sign was used to tell the container to ignore scope violations. request is in a special scope and the container throws an exception if you use it in a different scope.

Scopes were deprecated in Sf 2.8 and removed in Sf 3.0. See https://symfony.com/doc/2.8/service_container/scopes.html

Also, as of Symfony 2.4 you should use the request_stack: http://symfony.com/blog/new-in-symfony-2-4-the-request-stack