diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index f3376ae49a3..1b6a26e8256 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -173,6 +173,8 @@ will be autocompleted as the user types:: public function execute(InputInterface $input, OutputInterface $output) { // ... + $helper = $this->getHelper('question'); + $bundles = array('AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle'); $question = new Question('Please enter the name of a bundle', 'FooBundle'); $question->setAutocompleterValues($bundles); @@ -192,6 +194,8 @@ convenient for passwords:: public function execute(InputInterface $input, OutputInterface $output) { // ... + $helper = $this->getHelper('question'); + $question = new Question('What is the database password?'); $question->setHidden(true); $question->setHiddenFallback(false); @@ -225,6 +229,8 @@ method:: public function execute(InputInterface $input, OutputInterface $output) { // ... + $helper = $this->getHelper('question'); + $question = new Question('Please enter the name of the bundle', 'AppBundle'); $question->setNormalizer(function ($value) { // $value can be null here @@ -256,6 +262,8 @@ method:: public function execute(InputInterface $input, OutputInterface $output) { // ... + $helper = $this->getHelper('question'); + $question = new Question('Please enter the name of the bundle', 'AcmeDemoBundle'); $question->setValidator(function ($answer) { if (!is_string($answer) || 'Bundle' !== substr($answer, -6)) {