Symfony Services Deployment Syntax

I am working on a Symfony 2 application implemented by another company and came across the following service definition:

service_id: class: 'path\to\class' calls: - [setRequest, ['@?request=']] 

I know what the question mark in @?request= means (if the service does not exist, setRequest not called), but what does the equal sign at the end of the mean mean?

Thanks!

+5
source share
1 answer

An equal icon was used to tell the container to ignore visibility violations. request is in a special area, and the container throws an exception if you use it in another area.

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

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

+6
source

Source: https://habr.com/ru/post/1272386/


All Articles