Skip to content

Commit bce6455

Browse files
PapyDanoneskafandri
authored andcommitted
Make :purge and :delete commands compatible with Symfony 3.0 (#346)
* Replace deprecated Dialog helper in :purge command * Replace deprecated Dialog helper in :delete command
1 parent b43788b commit bce6455

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

Command/DeleteCommand.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Symfony\Component\Console\Input\InputInterface;
77
use Symfony\Component\Console\Input\InputOption;
88
use Symfony\Component\Console\Output\OutputInterface;
9+
use Symfony\Component\Console\Question\ConfirmationQuestion;
910

1011
/**
1112
* Command to delete a queue
@@ -32,8 +33,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
3233
$noConfirmation = (bool) $input->getOption('no-confirmation');
3334

3435
if (!$noConfirmation && $input->isInteractive()) {
35-
$confirmation = $this->getHelper('dialog')->askConfirmation($output, sprintf('<question>Are you sure you wish to delete "%s" consumer\'s queue?(y/n)</question>', $input->getArgument('name')), false);
36-
if (!$confirmation) {
36+
$question = new ConfirmationQuestion(
37+
sprintf(
38+
'<question>Are you sure you wish to delete "%s" consumer\'s queue? (y/n)</question>',
39+
$input->getArgument('name')
40+
),
41+
false
42+
);
43+
44+
if (!$this->getHelper('question')->ask($input, $output, $question)) {
3745
$output->writeln('<error>Deletion cancelled!</error>');
3846

3947
return 1;

Command/PurgeConsumerCommand.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use Symfony\Component\Console\Input\InputInterface;
77
use Symfony\Component\Console\Input\InputOption;
88
use Symfony\Component\Console\Output\OutputInterface;
9+
use Symfony\Component\Console\Question\ConfirmationQuestion;
910

1011
/**
1112
* Command to purge a queue
@@ -32,8 +33,15 @@ protected function execute(InputInterface $input, OutputInterface $output)
3233
$noConfirmation = (bool) $input->getOption('no-confirmation');
3334

3435
if (!$noConfirmation && $input->isInteractive()) {
35-
$confirmation = $this->getHelper('dialog')->askConfirmation($output, sprintf('<question>Are you sure you wish to purge "%s" queue? (y/n)</question>', $input->getArgument('name')), false);
36-
if (!$confirmation) {
36+
$question = new ConfirmationQuestion(
37+
sprintf(
38+
'<question>Are you sure you wish to purge "%s" queue? (y/n)</question>',
39+
$input->getArgument('name')
40+
),
41+
false
42+
);
43+
44+
if (!$this->getHelper('question')->ask($input, $output, $question)) {
3745
$output->writeln('<error>Purging cancelled!</error>');
3846

3947
return 1;

0 commit comments

Comments
 (0)