8000 [Book][ServiceContainer] Added docs for YAML '@@' escaping · symfony/symfony-docs@ed39ba0 · GitHub
[go: up one dir, main page]

Skip to content

Commit ed39ba0

Browse files
Thomas PlochThomas Ploch
Thomas Ploch
authored and
Thomas Ploch
committed
[Book][ServiceContainer] Added docs for YAML '@@' escaping
This PR deprecates #2286 | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes symfony/symfony#7357 | Applies to | 2.1 | Fixed tickets | symfony/symfony#4889
1 parent 76a0014 commit ed39ba0

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

book/service_container.rst

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,24 @@ looks up the value of each parameter and uses it in the service definition.
231231
232232
<argument type="string">http://symfony.com/?foo=%%s&bar=%%d</argument>
233233
234+
.. versionadded:: 2.1
235+
Escaping the ``@`` character in YAML parameter values is new in Symfony 2.1.9
236+
and Symfony 2.2.1.
237+
238+
.. note::
239+
240+
If you want to use a string that starts with an ``@`` sign as a parameter
241+
value (i.e. a very safe mailer password) in a yaml file, you need to escape
242+
it by adding another ``@`` sign (This only applies to the YAML format):
243+
244+
.. code-block:: yaml
245+
246+
# app/config/parameters.yml
247+
parameters:
248+
# This will be parsed as string "@securepass"
249+
mailer_password: "@@securepass"
250+
251+
234252
The purpose of parameters is to feed information into services. Of course
235253
there was nothing wrong with defining the service without using any parameters.
236254
Parameters, however, have several advantages:

0 commit comments

Comments
 (0)
0