Skip to content

Commit df16779

Browse files
committed
minor #4226 add note about parameters in imports (xabbuh)
This PR was merged into the 2.3 branch. Discussion ---------- add note about parameters in imports | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | all | Fixed tickets | #4207 Commits ------- a4e36ff add note about parameters in imports
2 parents eac0e51 + a4e36ff commit df16779

File tree

4 files changed

+37
-0
lines changed

4 files changed

+37
-0
lines changed

book/service_container.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,8 @@ configuration.
418418
// app/config/config.php
419419
$loader->import('@AcmeHelloBundle/Resources/config/services.php');
420420
421+
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc
422+
421423
The ``imports`` directive allows your application to include service container
422424
configuration resources from any other location (most commonly from bundles).
423425
The ``resource`` location, for files, is the absolute path to the resource
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.. note::
2+
3+
Due to the way in which parameters are resolved, you cannot use them to
4+
build paths in imports dynamically. This means that something like the
5+
following doesn't work:
6+
7+
.. configuration-block::
8+
9+
.. code-block:: yaml
10+
11+
# app/config/config.yml
12+
imports:
13+
- { resource: "%kernel.root_dir%/parameters.yml" }
14+
15+
.. code-block:: xml
16+
17+
<!-- app/config/config.xml -->
18+
<?xml version="1.0" encoding="UTF-8" ?>
19+
<container xmlns="http://symfony.com/schema/dic/services"
20+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21+
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
22+
23+
<imports>
24+
<import resource="%kernel.root_dir%/parameters.yml" />
25+
</imports>
26+
</container>
27+
28+
.. code-block:: php
29+
30+
// app/config/config.php
31+
$loader->import('%kernel.root_dir%/parameters.yml');

cookbook/configuration/configuration_organization.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ needed for the ``app/config/dev/config.yml`` file:
148148
149149
// ...
150150
151+
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc
152+
151153
Semantic Configuration Files
152154
----------------------------
153155

cookbook/configuration/environments.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ The best way to accomplish this is via a new environment called, for example,
262262
'profiler' => array('only-exceptions' => false),
263263
));
264264
265+
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc
266+
265267
And with this simple addition, the application now supports a new environment
266268
called ``benchmark``.
267269

0 commit comments

Comments
 (0)