From a4e36fff87ca38c81c9fee3a87065db17cf7b833 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Sat, 13 Sep 2014 17:58:34 +0200 Subject: [PATCH] add note about parameters in imports --- book/service_container.rst | 2 ++ .../_imports-parameters-note.rst.inc | 31 +++++++++++++++++++ .../configuration_organization.rst | 2 ++ cookbook/configuration/environments.rst | 2 ++ 4 files changed, 37 insertions(+) create mode 100644 components/dependency_injection/_imports-parameters-note.rst.inc diff --git a/book/service_container.rst b/book/service_container.rst index 423927eccef..287b1b47456 100644 --- a/book/service_container.rst +++ b/book/service_container.rst @@ -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 diff --git a/components/dependency_injection/_imports-parameters-note.rst.inc b/components/dependency_injection/_imports-parameters-note.rst.inc new file mode 100644 index 00000000000..3815b54e09b --- /dev/null +++ b/components/dependency_injection/_imports-parameters-note.rst.inc @@ -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 + + + + + + + + + + + .. code-block:: php + + // app/config/config.php + $loader->import('%kernel.root_dir%/parameters.yml'); diff --git a/cookbook/configuration/configuration_organization.rst b/cookbook/configuration/configuration_organization.rst index 52c5c0f0d4a..c455ee82e9f 100644 --- a/cookbook/configuration/configuration_organization.rst +++ b/cookbook/configuration/configuration_organization.rst @@ -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 ---------------------------- diff --git a/cookbook/configuration/environments.rst b/cookbook/configuration/environments.rst index d4884e2223a..5dae7d307ec 100644 --- a/cookbook/configuration/environments.rst +++ b/cookbook/configuration/environments.rst @@ -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``.