File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -86,11 +86,17 @@ Referencing Services
86
86
--------------------
87
87
88
88
Instead of using static values, you can also set the value to a service.
89
- Whenever the global variabele is accessed in the template, the service will be
89
+ Whenever the global variable is accessed in the template, the service will be
90
90
requested from the service container and you get access to that object.
91
91
92
- This is done by prefixing the string with ``@ ``, which you already know from
93
- injecting a service:
92
+ .. note ::
93
+
94
+ The service is not loaded lazily. In other words, as soon as Twig is
95
+ loaded, your service is instantiated, even if you never use that global
96
+ variable.
97
+
98
+ To define a service as a global Twig variable, prefix the string with ``@ ``.
99
+ This should feel familiar, as it's the same syntax you use in service configuration.
94
100
95
101
.. configuration-block ::
96
102
You can’t perform that action at this time.
0 commit comments