From ff1d8efb5650a3326f9eb71e1201d485c65e5404 Mon Sep 17 00:00:00 2001 From: ahmed lebbada Date: Tue, 31 Jan 2017 14:45:14 +0100 Subject: [PATCH 1/3] Updating parameters constants doc fix doc for setting constants in parameters (yaml) --- service_container/parameters.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/service_container/parameters.rst b/service_container/parameters.rst index 0c1890e3dfd..3b071323e27 100644 --- a/service_container/parameters.rst +++ b/service_container/parameters.rst @@ -219,12 +219,17 @@ for all parameters that are arrays. Constants as Parameters ----------------------- -The XML and PHP formats also have support for setting PHP constants as parameters. +Setting PHP constants as parameters is also supported. To take advantage of this feature, map the name of your constant to a parameter key and define the type as ``constant``. .. configuration-block:: + .. code-block:: yaml + parameters: + global.constant.value: !php/const:GLOBAL_CONSTANT + my_class.constant.value: !php/const:My_Class::CONSTANT_NAME + .. code-block:: xml From 6282c347ea5fb2c82b59817f514a1ba180e3d19c Mon Sep 17 00:00:00 2001 From: ahmed lebbada Date: Tue, 31 Jan 2017 14:49:27 +0100 Subject: [PATCH 2/3] Deleting useless tip --- service_container/parameters.rst | 9 --------- 1 file changed, 9 deletions(-) diff --git a/service_container/parameters.rst b/service_container/parameters.rst index 3b071323e27..1895f0602d5 100644 --- a/service_container/parameters.rst +++ b/service_container/parameters.rst @@ -248,15 +248,6 @@ key and define the type as ``constant``. $container->setParameter('global.constant.value', GLOBAL_CONSTANT); $container->setParameter('my_class.constant.value', My_Class::CONSTANT_NAME); -.. tip:: - - If you're using YAML, you can :doc:`import an XML file ` - to take advantage of this functionality: - - .. code-block:: yaml - - imports: - - { resource: parameters.xml } PHP Keywords in XML ------------------- From a5fabdaa6a0521f265dd0ee3b6e1806afe68effa Mon Sep 17 00:00:00 2001 From: ahmed lebbada Date: Tue, 31 Jan 2017 15:01:57 +0100 Subject: [PATCH 3/3] fix code-block --- service_container/parameters.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/service_container/parameters.rst b/service_container/parameters.rst index 1895f0602d5..8c303179cd8 100644 --- a/service_container/parameters.rst +++ b/service_container/parameters.rst @@ -226,6 +226,7 @@ key and define the type as ``constant``. .. configuration-block:: .. code-block:: yaml + parameters: global.constant.value: !php/const:GLOBAL_CONSTANT my_class.constant.value: !php/const:My_Class::CONSTANT_NAME