From c71721113e061217449e05168ad7676acfdf0581 Mon Sep 17 00:00:00 2001 From: Sanpi Date: Tue, 11 Apr 2017 22:23:42 +0200 Subject: [PATCH 1/2] [config] Add a note about deprecated a node --- components/config/definition.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index 59933695f47..bdfa57d99d3 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -423,6 +423,26 @@ has a certain value: ->end() ; +Deprecated the Option +--------------------- + +You can depreciate an option by using the +:method:`Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::setDeprecated` +method. + +.. code-block:: php + + $rootNode + ->children() + ->integerNode('old_option') + ->setDeprecated() + ->end() + ->end() + ; + +If you use the Web Debug Toolbar, the deprecation notice will be showed when the +configuration is rebuilt. + Documenting the Option ---------------------- From 985376d5d80c2b92a3e1c5e138612f054980919f Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Mon, 9 Oct 2017 16:40:51 +0200 Subject: [PATCH 2/2] Explained the possibility of defining custom deprecation messages --- components/config/definition.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/components/config/definition.rst b/components/config/definition.rst index bdfa57d99d3..9c8e33435f0 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -423,24 +423,27 @@ has a certain value: ->end() ; -Deprecated the Option ---------------------- +Deprecating the Option +---------------------- -You can depreciate an option by using the +You can deprecate options using the :method:`Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::setDeprecated` -method. - -.. code-block:: php +method:: $rootNode ->children() ->integerNode('old_option') + // this outputs the following generic deprecation message: + // The child node "old_option" at path "..." is deprecated. ->setDeprecated() + + // you can also pass a custom deprecation message (%node% and %path% placeholders are available): + ->setDeprecated('The "%node%" option is deprecated. Use "new_config_option" instead.') ->end() ->end() ; -If you use the Web Debug Toolbar, the deprecation notice will be showed when the +If you use the Web Debug Toolbar, these deprecation notices are shown when the configuration is rebuilt. Documenting the Option