Skip to content

added some doc about optional sections #1788

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 8, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,29 @@ has a certain value:
->end()
;

Optional Sections
-----------------
If you have entire sections which are optional and can be enabled/disabled,
you can take advantage of the shortcut ``canBeEnabled``, or ``canBeDisabled``::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the :method: syntax here too.


$arrayNode
->canBeEnabled()
;

// is equivalent to

$arrayNode
->treatFalseLike(array('enabled' => false))
->treatTrueLike(array('enabled' => true))
->treatNullLike(array('enabled' => true))
->children()
->booleanNode('enabled')
->defaultFalse()
;

``canBeDisabled`` looks about the same with the difference that the section
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should use the :method: syntax so that it links to the API doc

would be enabled by default.

Merging options
---------------

Expand Down