Skip to content

Commit 40f7fdf

Browse files
committed
Merge branch 'tPl0ch-feature/di-parameter-escape' into 2.1
2 parents bc9febe + f48b10a commit 40f7fdf

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

book/service_container.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,23 @@ The end result is exactly the same as before - the difference is only in
227227
to look for parameters with those names. When the container is built, it
228228
looks up the value of each parameter and uses it in the service definition.
229229

230+
.. versionadded:: 2.1
231+
Escaping the ``@`` character in YAML parameter values is new in Symfony 2.1.9
232+
and Symfony 2.2.1.
233+
234+
.. note::
235+
236+
If you want to use a string that starts with an ``@`` sign as a parameter
237+
value (i.e. a very safe mailer password) in a yaml file, you need to escape
238+
it by adding another ``@`` sign (This only applies to the YAML format):
239+
240+
.. code-block:: yaml
241+
242+
# app/config/parameters.yml
243+
parameters:
244+
# This will be parsed as string "@securepass"
245+
mailer_password: "@@securepass"
246+
230247
The purpose of parameters is to feed information into services. Of course
231248
there was nothing wrong with defining the service without using any parameters.
232249
Parameters, however, have several advantages:

0 commit comments

Comments
 (0)