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 a1435e5

Browse filesBrowse files
committed
bug #3998 [Console] Fixed QuestionHelper examples (florianv)
This PR was merged into the 2.5 branch. Discussion ---------- [Console] Fixed QuestionHelper examples | Q | A | ------------- | --- | Doc fix? | yes | New docs? | no | Applies to | 2.5+ | Fixed tickets | The default value corresponds to the index of the choice in the array, not it's name. Commits ------- 97c3894 [Console] Fixed QuestionHelper examples
2 parents ec832dc + 97c3894 commit a1435e5
Copy full SHA for a1435e5

File tree

Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-3
lines changed

‎components/console/helpers/questionhelper.rst

Copy file name to clipboardExpand all lines: components/console/helpers/questionhelper.rst
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ from a predefined list::
7777
$question = new ChoiceQuestion(
7878
'Please select your favorite color (defaults to red)',
7979
array('red', 'blue', 'yellow'),
80-
'red'
80+
0
8181
);
8282
$question->setErrorMessage('Color %s is invalid.');
8383

@@ -109,9 +109,9 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
109109

110110
$helper = $this->getHelper('question');
111111
$question = new ChoiceQuestion(
112-
'Please select your favorite color (defaults to red)',
112+
'Please select your favorite colors (defaults to red and blue)',
113113
array('red', 'blue', 'yellow'),
114-
'red'
114+
'0,1'
115115
);
116116
$question->setMultiselect(true);
117117

@@ -121,6 +121,9 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
121121
Now, when the user enters ``1,2``, the result will be:
122122
``You have just selected: blue, yellow``.
123123

124+
If the user does not enter anything, the result will be:
125+
``You have just selected: red, blue``.
126+
124127
Autocompletion
125128
~~~~~~~~~~~~~~
126129

0 commit comments

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