Skip to content

Commit

Permalink
minor #4226 add note about parameters in imports (xabbuh)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
weaverryan committed Oct 1, 2014
2 parents eac0e51 + a4e36ff commit df16779
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions book/service_container.rst
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ configuration.
// app/config/config.php
$loader->import('@AcmeHelloBundle/Resources/config/services.php');
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc

The ``imports`` directive allows your application to include service container
configuration resources from any other location (most commonly from bundles).
The ``resource`` location, for files, is the absolute path to the resource
Expand Down
31 changes: 31 additions & 0 deletions components/dependency_injection/_imports-parameters-note.rst.inc
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
.. note::

Due to the way in which parameters are resolved, you cannot use them to
build paths in imports dynamically. This means that something like the
following doesn't work:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
imports:
- { resource: "%kernel.root_dir%/parameters.yml" }

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">

<imports>
<import resource="%kernel.root_dir%/parameters.yml" />
</imports>
</container>

.. code-block:: php

// app/config/config.php
$loader->import('%kernel.root_dir%/parameters.yml');
2 changes: 2 additions & 0 deletions cookbook/configuration/configuration_organization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ needed for the ``app/config/dev/config.yml`` file:
// ...
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc

Semantic Configuration Files
----------------------------

Expand Down
2 changes: 2 additions & 0 deletions cookbook/configuration/environments.rst
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,8 @@ The best way to accomplish this is via a new environment called, for example,
'profiler' => array('only-exceptions' => false),
));
.. include:: /components/dependency_injection/_imports-parameters-note.rst.inc

And with this simple addition, the application now supports a new environment
called ``benchmark``.

Expand Down

0 comments on commit df16779

Please sign in to comment.