Skip to content

Commit

Permalink
Replaced deceprecated dialog helper for question helper
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-marcel committed Feb 8, 2016
1 parent ce79673 commit dc8ea58
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 16 deletions.
14 changes: 6 additions & 8 deletions Command/DoctrineDecryptDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

/**
* Hello World command for demo purposes.
Expand All @@ -34,9 +35,9 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
//Get entity manager, dialog helper, subscriber service and annotation reader
//Get entity manager, question helper, subscriber service and annotation reader
$entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
$dialog = $this->getHelper('dialog');
$question = $this->getHelper('question');
$subscriber = $this->getContainer()->get('ambta_doctrine_encrypt.subscriber');
$annotationReader = new AnnotationReader();

Expand Down Expand Up @@ -79,12 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

//Create confirmation dialog
if (!$dialog->askConfirmation(
$output,
"<question>\n" . count($metaDataArray) . " entitys found which are containing " . $propertyCount . " properties with the encryption tag. \n\nWhich are going to be decrypted with [" . $subscriber->getEncryptor() . "]. \n\nWrong settings can mess up your data and it will be unrecoverable. \nI advise you to make <bg=yellow;options=bold>a backup</bg=yellow;options=bold>. \n\nContinu with this action? (y/yes)</question>",
false
)) {
$confirmationQuestion = new ConfirmationQuestion("<question>\n" . count($metaDataArray) . " entitys found which are containing " . $propertyCount . " properties with the encryption tag. \n\nWhich are going to be decrypted with [" . $subscriber->getEncryptor() . "]. \n\nWrong settings can mess up your data and it will be unrecoverable. \nI advise you to make <bg=yellow;options=bold>a backup</bg=yellow;options=bold>. \n\nContinu with this action? (y/yes)</question>", false);

if (!$question->ask($input, $output, $confirmationQuestion)) {
return;
}

Expand Down
14 changes: 6 additions & 8 deletions Command/DoctrineEncryptDatabaseCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Symfony\Component\Console\Input\InputArgument;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Question\ConfirmationQuestion;

/**
* Hello World command for demo purposes.
Expand All @@ -34,9 +35,9 @@ protected function configure()
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
//Get entity manager, dialog helper, subscriber service and annotation reader
//Get entity manager, question helper, subscriber service and annotation reader
$entityManager = $this->getContainer()->get('doctrine.orm.entity_manager');
$dialog = $this->getHelper('dialog');
$question = $this->getHelper('question');
$subscriber = $this->getContainer()->get('ambta_doctrine_encrypt.subscriber');
$annotationReader = new AnnotationReader();

Expand Down Expand Up @@ -79,12 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
}

//Create confirmation dialog
if (!$dialog->askConfirmation(
$output,
"<question>\n" . count($metaDataArray) . " entitys found which are containing " . $propertyCount . " properties with the encryption tag. \n\nWhich are going to be encrypted with [" . $subscriber->getEncryptor() . "]. \n\nWrong settings can mess up your data and it will be unrecoverable. \nI advise you to make <bg=yellow;options=bold>a backup</bg=yellow;options=bold>. \n\nContinu with this action? (y/yes)</question>",
false
)) {
$confirmationQuestion = new ConfirmationQuestion("<question>\n" . count($metaDataArray) . " entitys found which are containing " . $propertyCount . " properties with the encryption tag. \n\nWhich are going to be encrypted with [" . $subscriber->getEncryptor() . "]. \n\nWrong settings can mess up your data and it will be unrecoverable. \nI advise you to make <bg=yellow;options=bold>a backup</bg=yellow;options=bold>. \n\nContinu with this action? (y/yes)</question>", false);

if (!$question->ask($input, $output, $confirmationQuestion)) {
return;
}

Expand Down

0 comments on commit dc8ea58

Please sign in to comment.