@@ -286,7 +286,7 @@ key, and define the type as ``constant``.
286
286
imports :
287
287
- { resource: parameters.xml }
288
288
289
- PHP keywords in XML
289
+ PHP Keywords in XML
290
290
-------------------
291
291
292
292
By default, ``true ``, ``false `` and ``null `` in XML are converted to the PHP
@@ -302,7 +302,7 @@ keywords (respectively ``true``, ``false`` and ``null``):
302
302
$container->getParameter('mailer.send_all_in_once'); // returns false
303
303
-->
304
304
305
- To disable this behaviour , use the ``string `` type:
305
+ To disable this behavior , use the ``string `` type:
306
306
307
307
.. code-block :: xml
308
308
@@ -319,33 +319,38 @@ To disable this behaviour, use the ``string`` type:
319
319
This is not available for Yaml and PHP, because they already have built-in
320
320
support for the PHP keywords.
321
321
322
- Referencing Services with Parameters
323
- ------------------------------------
322
+ Syntax for Referencing Services
323
+ -------------------------------
324
324
325
- A parameter can also reference to a service. While doing so, it specifies an
326
- invalid behaviour.
325
+ You can of course also reference services, which looks a bit different in
326
+ each format. You can configure the behavior if the referenced service does
327
+ not exist. By default, an exception is thrown when a non-existent service
328
+ is referenced.
327
329
328
330
Yaml
329
331
~~~~
330
332
331
- Start the string with ``@ ``, `` @@ `` or ``@? `` to reference a service in Yaml.
333
+ Start the string with ``@ `` or ``@? `` to reference a service in Yaml.
332
334
333
- * ``@mailer `` references to the ``mailer `` service. If the service does not
335
+ * ``@mailer `` references the ``mailer `` service. If the service does not
334
336
exists, an exception will be thrown;
335
- * ``@?mailer `` references to the ``mailer `` service. If the service does not
337
+ * ``@?mailer `` references the ``mailer `` service. If the service does not
336
338
exists, it will be ignored;
337
339
338
340
Xml
339
341
~~~
340
342
341
- In XML, use the ``service `` type. The behaviour if the service does not exists
342
- can be specified using the ``on-invalid `` argument (it can be set to ``null ``
343
- to return ``null `` or ``ignored `` to let the container ignore the error, if
344
- not specified it throws an exception).
343
+ In XML, use the ``service `` type. The behavior if the service does not exists
344
+ can be specified using the ``on-invalid `` argument. By default, an exception
345
+ is thrown. Valid values for ``on-invalid `` are ``null `` (uses ``null `` in place
346
+ of the missing service) or ``ignored `` (very similar, except if used on a
347
+ method call, the method call is removed).
345
348
346
349
Php
347
350
~~~
348
351
349
352
In PHP, you can use the
350
353
:class: `Symfony\\ Component\\ DependencyInjection\\ Reference ` class to reference
351
- a service.
354
+ a service. The invalid behavior is configured using the second constructor
355
+ argument and constants from
356
+ :class: `Symfony\\ Component\\ DependencyInjection\\ ContainerInterface `.
0 commit comments