Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit f8ddf1f

Browse filesBrowse files
committed
minor #7794 [config] Add a note about deprecated a node (sanpii, javiereguiluz)
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
2 parents c3c6772 + 1939371 commit f8ddf1f
Copy full SHA for f8ddf1f

File tree

1 file changed

+23
-0
lines changed
Filter options

1 file changed

+23
-0
lines changed

‎components/config/definition.rst

Copy file name to clipboardExpand all lines: components/config/definition.rst
+23Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,29 @@ has a certain value:
424424
->end()
425425
;
426426
427+
Deprecating the Option
428+
----------------------
429+
430+
You can deprecate options using the
431+
:method:`Symfony\\Component\\Config\\Definition\\Builder\\NodeDefinition::setDeprecated`
432+
method::
433+
434+
$rootNode
435+
->children()
436+
->integerNode('old_option')
437+
// this outputs the following generic deprecation message:
438+
// The child node "old_option" at path "..." is deprecated.
439+
->setDeprecated()
440+
441+
// you can also pass a custom deprecation message (%node% and %path% placeholders are available):
442+
->setDeprecated('The "%node%" option is deprecated. Use "new_config_option" instead.')
443+
->end()
444+
->end()
445+
;
446+
447+
If you use the Web Debug Toolbar, these deprecation notices are shown when the
448+
configuration is rebuilt.
449+
427450
Documenting the Option
428451
----------------------
429452

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.