File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change @@ -304,8 +304,6 @@ configuration file using a special syntax: wrap the parameter name in two ``%``
304
304
# any string surrounded by two % is replaced by that parameter value
305
305
email_address : ' %app.admin_email%'
306
306
307
- # ...
308
-
309
307
.. code-block :: xml
310
308
311
309
<!-- config/packages/some_package.xml -->
@@ -328,13 +326,17 @@ configuration file using a special syntax: wrap the parameter name in two ``%``
328
326
329
327
// config/packages/some_package.php
330
328
namespace Symfony\Component\DependencyInjection\Loader\Configurator;
329
+ use function Symfony\Component\DependencyInjection\Loader\Configurator\param;
331
330
332
331
return static function (ContainerConfigurator $container) {
333
332
$container->extension('some_package', [
334
- // any string surrounded by two % is replaced by that parameter value
335
- 'email_address' => '% app.admin_email%' ,
333
+ // when using the param() function, you only have to pass the parameter name...
334
+ 'email_address' => param(' app.admin_email') ,
336
335
337
- // ...
336
+ // ... but if you prefer it, you can also pass the name as a string
337
+ // surrounded by two % (same as in YAML and XML formats) and Symfony will
338
+ // replace it by that parameter value
339
+ 'email_address' => '%app.admin_email%',
338
340
]);
339
341
};
340
342
You can’t perform that action at this time.
0 commit comments