diff --git a/components/config/definition.rst b/components/config/definition.rst index 59933695f47..9c8e33435f0 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -423,6 +423,29 @@ has a certain value: ->end() ; +Deprecating the Option +---------------------- + +You can deprecate options using the +:method:`Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::setDeprecated` +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, these deprecation notices are shown when the +configuration is rebuilt. + Documenting the Option ----------------------