From dc8ea58c40662ce00cf39d2cd1d45c25ecf35478 Mon Sep 17 00:00:00 2001 From: Marcel Date: Mon, 8 Feb 2016 09:56:52 +0100 Subject: [PATCH] Replaced deceprecated dialog helper for question helper --- Command/DoctrineDecryptDatabaseCommand.php | 14 ++++++-------- Command/DoctrineEncryptDatabaseCommand.php | 14 ++++++-------- 2 files changed, 12 insertions(+), 16 deletions(-) diff --git a/Command/DoctrineDecryptDatabaseCommand.php b/Command/DoctrineDecryptDatabaseCommand.php index 393739f0..eda7df98 100644 --- a/Command/DoctrineDecryptDatabaseCommand.php +++ b/Command/DoctrineDecryptDatabaseCommand.php @@ -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. @@ -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(); @@ -79,12 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - //Create confirmation dialog - if (!$dialog->askConfirmation( - $output, - "\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 a backup. \n\nContinu with this action? (y/yes)", - false - )) { + $confirmationQuestion = new ConfirmationQuestion("\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 a backup. \n\nContinu with this action? (y/yes)", false); + + if (!$question->ask($input, $output, $confirmationQuestion)) { return; } diff --git a/Command/DoctrineEncryptDatabaseCommand.php b/Command/DoctrineEncryptDatabaseCommand.php index 2b487c08..2a36690d 100644 --- a/Command/DoctrineEncryptDatabaseCommand.php +++ b/Command/DoctrineEncryptDatabaseCommand.php @@ -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. @@ -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(); @@ -79,12 +80,9 @@ protected function execute(InputInterface $input, OutputInterface $output) } } - //Create confirmation dialog - if (!$dialog->askConfirmation( - $output, - "\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 a backup. \n\nContinu with this action? (y/yes)", - false - )) { + $confirmationQuestion = new ConfirmationQuestion("\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 a backup. \n\nContinu with this action? (y/yes)", false); + + if (!$question->ask($input, $output, $confirmationQuestion)) { return; }