@@ -150,19 +150,19 @@ making the class of a service a parameter:
150
150
The percent sign inside a parameter or argument, as part of the string, must
151
151
be escaped with another percent sign:
152
152
153
- .. configuration-block ::
153
+ .. configuration-block ::
154
154
155
- .. code-block :: yaml
155
+ .. code-block :: yaml
156
156
157
- arguments : ['http://symfony.com/?foo=%%s&bar=%%d']
157
+ arguments : ['http://symfony.com/?foo=%%s&bar=%%d']
158
158
159
- .. code-block :: xml
159
+ .. code-block :: xml
160
160
161
- <argument type =" string" >http://symfony.com/?foo=%%s& bar=%%d</argument >
161
+ <argument type =" string" >http://symfony.com/?foo=%%s& bar=%%d</argument >
162
162
163
- .. code-block :: php
163
+ .. code-block :: php
164
164
165
- ->addArgument('http://symfony.com/?foo=%%s&bar=%%d');
165
+ ->addArgument('http://symfony.com/?foo=%%s&bar=%%d');
166
166
167
167
Array Parameters
168
168
----------------
@@ -228,22 +228,29 @@ The container also has support for setting PHP constants as parameters. To
228
228
take advantage of this feature, map the name of your constant to a parameter
229
229
key, and define the type as ``constant ``.
230
230
231
- .. code -block :: xml
231
+ .. configuration -block ::
232
232
233
- <? xml version = " 1.0 " encoding = " UTF-8 " ?>
233
+ .. code-block :: xml
234
234
235
- <container xmlns =" http://symfony.com/schema/dic/services"
236
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
235
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
237
236
238
- <parameters >
239
- <parameter key =" global.constant.value" type =" constant" >GLOBAL_CONSTANT</parameter >
240
- <parameter key =" my_class.constant.value" type =" constant" >My_Class::CONSTANT_NAME</parameter >
241
- </parameters >
242
- </container >
237
+ <container xmlns =" http://symfony.com/schema/dic/services"
238
+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance" >
239
+
240
+ <parameters >
241
+ <parameter key =" global.constant.value" type =" constant" >GLOBAL_CONSTANT</parameter >
242
+ <parameter key =" my_class.constant.value" type =" constant" >My_Class::CONSTANT_NAME</parameter >
243
+ </parameters >
244
+ </container >
245
+
246
+ .. code-block :: php
247
+
248
+ $container->setParameter('global.constant.value', GLOBAL_CONSTANT);
249
+ $container->setParameter('my_class.constant.value', My_Class::CONSTANT_NAME);
243
250
244
251
.. note ::
245
252
246
- This only works for XML configuration. If you're * not * using XML, simply
253
+ This does not works for Yaml configuration. If you're using Yaml, you can
247
254
import an XML file to take advantage of this functionality:
248
255
249
256
.. configuration-block ::
@@ -253,9 +260,3 @@ key, and define the type as ``constant``.
253
260
# app/config/config.yml
254
261
imports :
255
262
- { resource: parameters.xml }
256
-
257
- .. code-block :: php
258
-
259
- // app/config/config.php
260
- $loader->import('parameters.xml');
261
-
0 commit comments