Skip to content

add note about parameters in imports #4226

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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