Skip to content

Commit 907ce98

Browse files
authored
Merge pull request #109 from easybiblabs/fix/destroy-command
command/queueDestroyCommand: replace dialog helper with question helper
2 parents 646d8d2 + 4023137 commit 907ce98

1 file changed

Lines changed: 12 additions & 18 deletions

File tree

src/Command/QueueDestroyCommand.php

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
use Symfony\Component\Console\Input\InputInterface;
2828
use Symfony\Component\Console\Input\InputOption;
2929
use Symfony\Component\Console\Output\OutputInterface;
30+
use Symfony\Component\Console\Question\ConfirmationQuestion;
3031
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
3132
use Symfony\Component\DependencyInjection\ContainerInterface;
3233

@@ -80,22 +81,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
8081
{
8182
$this->output = $output;
8283
$registry = $this->container->get('uecode_qpush');
83-
$dialog = $this->getHelperSet()->get('dialog');
84-
84+
$questionHelper = $this->getHelperSet()->get('question');
8585
$name = $input->getArgument('name');
8686

8787
if (null !== $name) {
8888
if (!$input->getOption('force')) {
89-
$response = $dialog->askConfirmation(
90-
$output,
91-
sprintf(
92-
'<comment>This will remove the %s queue, even if it has messages! Are you sure? </comment>',
93-
$name
94-
),
95-
false
96-
);
97-
98-
if (!$response) {
89+
$question = new ConfirmationQuestion(sprintf(
90+
'<comment>This will remove the %s queue, even if it has messages! Are you sure? </comment>',
91+
$name
92+
));
93+
$confirmation = $questionHelper->ask($input, $output, $question);
94+
95+
if (!$confirmation) {
9996
return 0;
10097
}
10198
}
@@ -104,13 +101,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
104101
}
105102

106103
if (!$input->getOption('force')) {
107-
$response = $dialog->askConfirmation(
108-
$output,
109-
'<comment>This will remove ALL queues, even if they have messages. Are you sure? </comment>',
110-
false
111-
);
104+
$question = new ConfirmationQuestion('<comment>This will remove ALL queues, even if they have messages. Are you sure? </comment>');
105+
$confirmation = $questionHelper->ask($input, $output, $question);
112106

113-
if (!$response) {
107+
if (!$confirmation) {
114108
return 0;
115109
}
116110
}

0 commit comments

Comments
 (0)