Skip to content

Commit ea54460

Browse files
committed
minor #7434 Fix doc for yaml parameters constants usage (sidux)
This PR was squashed before being merged into the 3.2 branch (closes #7434). Discussion ---------- Fix doc for yaml parameters constants usage update doc for constants usage, since yaml supports constants since 3.2 Commits ------- 9635f0f Fix doc for yaml parameters constants usage
2 parents c2481c4 + 9635f0f commit ea54460

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

service_container/parameters.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,18 @@ for all parameters that are arrays.
219219
Constants as Parameters
220220
-----------------------
221221

222-
The XML and PHP formats also have support for setting PHP constants as parameters.
222+
Setting PHP constants as parameters is also supported.
223223
To take advantage of this feature, map the name of your constant to a parameter
224224
key and define the type as ``constant``.
225225

226226
.. configuration-block::
227227

228+
.. code-block:: yaml
229+
230+
parameters:
231+
global.constant.value: !php/const:GLOBAL_CONSTANT
232+
my_class.constant.value: !php/const:My_Class::CONSTANT_NAME
233+
228234
.. code-block:: xml
229235
230236
<?xml version="1.0" encoding="UTF-8" ?>
@@ -243,15 +249,6 @@ key and define the type as ``constant``.
243249
$container->setParameter('global.constant.value', GLOBAL_CONSTANT);
244250
$container->setParameter('my_class.constant.value', My_Class::CONSTANT_NAME);
245251
246-
.. tip::
247-
248-
If you're using YAML, you can :doc:`import an XML file </service_container/import>`
249-
to take advantage of this functionality:
250-
251-
.. code-block:: yaml
252-
253-
imports:
254-
- { resource: parameters.xml }
255252
256253
PHP Keywords in XML
257254
-------------------

0 commit comments

Comments
 (0)