Skip to content

Commit

Permalink
minor #7794 [config] Add a note about deprecated a node (sanpii, javi…
Browse files Browse the repository at this point in the history
…ereguiluz)

This PR was submitted for the master branch but it was merged into the 3.4 branch instead (closes #7794).

Discussion
----------

[config] Add a note about deprecated a node

Documentation for symfony/symfony#22382

Commits
-------

1939371 Explained the possibility of defining custom deprecation messages
d6a8624 [config] Add a note about deprecated a node
  • Loading branch information
xabbuh committed Oct 13, 2017
2 parents c3c6772 + 1939371 commit f8ddf1f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -424,6 +424,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
----------------------

Expand Down

0 comments on commit f8ddf1f

Please sign in to comment.