Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb5c19be

Browse files
committed
[symfony#2882] Minor tweaks and additional information added
1 parent826591d commitb5c19be

File tree

1 file changed

+19
-14
lines changed

1 file changed

+19
-14
lines changed

‎components/dependency_injection/parameters.rst‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ key, and define the type as ``constant``.
286286
imports:
287287
-{ resource: parameters.xml }
288288
289-
PHPkeywords in XML
289+
PHPKeywords in XML
290290
-------------------
291291

292292
By default, ``true``, ``false`` and ``null`` in XML are converted to the PHP
@@ -302,7 +302,7 @@ keywords (respectively ``true``, ``false`` and ``null``):
302302
$container->getParameter('mailer.send_all_in_once'); // returns false
303303
-->
304304
305-
To disable thisbehaviour, use the ``string`` type:
305+
To disable thisbehavior, use the ``string`` type:
306306

307307
..code-block::xml
308308
@@ -319,33 +319,38 @@ To disable this behaviour, use the ``string`` type:
319319
This is not available for Yaml and PHP, because they already have built-in
320320
support for the PHP keywords.
321321

322-
Referencing Services with Parameters
323-
------------------------------------
322+
Syntax for Referencing Services
323+
-------------------------------
324324

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.
327329

328330
Yaml
329331
~~~~
330332

331-
Start the string with ``@``, ``@@`` or ``@?`` to reference a service in Yaml.
333+
Start the string with ``@`` or ``@?`` to reference a service in Yaml.
332334

333-
* ``@mailer`` referencestothe ``mailer`` service. If the service does not
335+
* ``@mailer`` references the ``mailer`` service. If the service does not
334336
exists, an exception will be thrown;
335-
* ``@?mailer`` referencestothe ``mailer`` service. If the service does not
337+
* ``@?mailer`` references the ``mailer`` service. If the service does not
336338
exists, it will be ignored;
337339

338340
Xml
339341
~~~
340342

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).
345348

346349
Php
347350
~~~
348351

349352
In PHP, you can use the
350353
: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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp