Skip to content

Commit

Permalink
Merge pull request #109 from easybiblabs/fix/destroy-command
Browse files Browse the repository at this point in the history
command/queueDestroyCommand: replace dialog helper with question helper
  • Loading branch information
k-k authored Aug 8, 2016
2 parents 646d8d2 + 4023137 commit 907ce98
Showing 1 changed file with 12 additions and 18 deletions.
30 changes: 12 additions & 18 deletions src/Command/QueueDestroyCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;

Expand Down Expand Up @@ -80,22 +81,18 @@ protected function execute(InputInterface $input, OutputInterface $output)
{
$this->output = $output;
$registry = $this->container->get('uecode_qpush');
$dialog = $this->getHelperSet()->get('dialog');

$questionHelper = $this->getHelperSet()->get('question');
$name = $input->getArgument('name');

if (null !== $name) {
if (!$input->getOption('force')) {
$response = $dialog->askConfirmation(
$output,
sprintf(
'<comment>This will remove the %s queue, even if it has messages! Are you sure? </comment>',
$name
),
false
);

if (!$response) {
$question = new ConfirmationQuestion(sprintf(
'<comment>This will remove the %s queue, even if it has messages! Are you sure? </comment>',
$name
));
$confirmation = $questionHelper->ask($input, $output, $question);

if (!$confirmation) {
return 0;
}
}
Expand All @@ -104,13 +101,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
}

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

if (!$response) {
if (!$confirmation) {
return 0;
}
}
Expand Down

0 comments on commit 907ce98

Please sign in to comment.