Permalink
Browse files

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
  • Loading branch information...
weaverryan committed Jul 11, 2014
2 parents ec832dc + 97c3894 commit a1435e57fd95e14ffff171f797133a1c52569cb1
Showing with 6 additions and 3 deletions.
  1. +6 −3 components/console/helpers/questionhelper.rst
@@ -77,7 +77,7 @@ from a predefined list::
$question = new ChoiceQuestion(
'Please select your favorite color (defaults to red)',
array('red', 'blue', 'yellow'),
'red'
0
);
$question->setErrorMessage('Color %s is invalid.');
@@ -109,9 +109,9 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
$helper = $this->getHelper('question');
$question = new ChoiceQuestion(
'Please select your favorite color (defaults to red)',
'Please select your favorite colors (defaults to red and blue)',
array('red', 'blue', 'yellow'),
'red'
'0,1'
);
$question->setMultiselect(true);
@@ -121,6 +121,9 @@ this use :method:`Symfony\\Component\\Console\\Question\\ChoiceQuestion::setMult
Now, when the user enters ``1,2``, the result will be:
``You have just selected: blue, yellow``.
If the user does not enter anything, the result will be:
``You have just selected: red, blue``.
Autocompletion
~~~~~~~~~~~~~~

0 comments on commit a1435e5

Please sign in to comment.