From 186a2d42785c24ea800e705a630f5c44a038d4ec Mon Sep 17 00:00:00 2001 From: Douglas Reith Date: Wed, 21 Mar 2018 12:10:50 +0000 Subject: [PATCH] Add deprecated notices to duplicate Doctrine commands, for #1 --- Command/MigrationsExecuteDoctrineCommand.php | 29 +++++++------------ Command/MigrationsGenerateDoctrineCommand.php | 29 +++++++------------ Command/MigrationsMigrateDoctrineCommand.php | 29 +++++++------------ Command/MigrationsStatusDoctrineCommand.php | 29 +++++++------------ Command/MigrationsVersionDoctrineCommand.php | 29 +++++++------------ 5 files changed, 50 insertions(+), 95 deletions(-) diff --git a/Command/MigrationsExecuteDoctrineCommand.php b/Command/MigrationsExecuteDoctrineCommand.php index 15a9e23..0398984 100644 --- a/Command/MigrationsExecuteDoctrineCommand.php +++ b/Command/MigrationsExecuteDoctrineCommand.php @@ -11,33 +11,24 @@ namespace AntiMattr\Bundle\MongoDBMigrationsBundle\Command; -use AntiMattr\MongoDB\Migrations\Tools\Console\Command\ExecuteCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - /** * @author Matthew Fitzgerald + * + * @deprecated will be removed in version 2.0 */ -class MigrationsExecuteDoctrineCommand extends ExecuteCommand +class MigrationsExecuteDoctrineCommand extends MigrationsExecuteCommand { protected function configure() { parent::configure(); - $this - ->setName('mongodb:migrations:execute') - ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - CommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm')); - - $configuration = $this->getMigrationConfiguration($input, $output); - CommandHelper::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); + $replacement = str_replace('Doctrine', '', __CLASS__); + $notice = sprintf( + '%s is deprecated and will be removed in 2.0. Use %s instead', + __CLASS__, + $replacement + ); - parent::execute($input, $output); + @trigger_error($notice, E_USER_DEPRECATED); } } diff --git a/Command/MigrationsGenerateDoctrineCommand.php b/Command/MigrationsGenerateDoctrineCommand.php index 4519b81..02991e9 100644 --- a/Command/MigrationsGenerateDoctrineCommand.php +++ b/Command/MigrationsGenerateDoctrineCommand.php @@ -11,33 +11,24 @@ namespace AntiMattr\Bundle\MongoDBMigrationsBundle\Command; -use AntiMattr\MongoDB\Migrations\Tools\Console\Command\GenerateCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - /** * @author Matthew Fitzgerald + * + * @deprecated will be removed in version 2.0 */ -class MigrationsGenerateDoctrineCommand extends GenerateCommand +class MigrationsGenerateDoctrineCommand extends MigrationsGenerateCommand { protected function configure() { parent::configure(); - $this - ->setName('mongodb:migrations:generate') - ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - CommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm')); - - $configuration = $this->getMigrationConfiguration($input, $output); - CommandHelper::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); + $replacement = str_replace('Doctrine', '', __CLASS__); + $notice = sprintf( + '%s is deprecated and will be removed in 2.0. Use %s instead', + __CLASS__, + $replacement + ); - parent::execute($input, $output); + @trigger_error($notice, E_USER_DEPRECATED); } } diff --git a/Command/MigrationsMigrateDoctrineCommand.php b/Command/MigrationsMigrateDoctrineCommand.php index 65bf22c..6b8f02d 100644 --- a/Command/MigrationsMigrateDoctrineCommand.php +++ b/Command/MigrationsMigrateDoctrineCommand.php @@ -11,33 +11,24 @@ namespace AntiMattr\Bundle\MongoDBMigrationsBundle\Command; -use AntiMattr\MongoDB\Migrations\Tools\Console\Command\MigrateCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - /** * @author Matthew Fitzgerald + * + * @deprecated will be removed in version 2.0 */ -class MigrationsMigrateDoctrineCommand extends MigrateCommand +class MigrationsMigrateDoctrineCommand extends MigrationsMigrateCommand { protected function configure() { parent::configure(); - $this - ->setName('mongodb:migrations:migrate') - ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - CommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm')); - - $configuration = $this->getMigrationConfiguration($input, $output); - CommandHelper::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); + $replacement = str_replace('Doctrine', '', __CLASS__); + $notice = sprintf( + '%s is deprecated and will be removed in 2.0. Use %s instead', + __CLASS__, + $replacement + ); - parent::execute($input, $output); + @trigger_error($notice, E_USER_DEPRECATED); } } diff --git a/Command/MigrationsStatusDoctrineCommand.php b/Command/MigrationsStatusDoctrineCommand.php index 8f32a58..57c08cd 100644 --- a/Command/MigrationsStatusDoctrineCommand.php +++ b/Command/MigrationsStatusDoctrineCommand.php @@ -11,33 +11,24 @@ namespace AntiMattr\Bundle\MongoDBMigrationsBundle\Command; -use AntiMattr\MongoDB\Migrations\Tools\Console\Command\StatusCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - /** * @author Matthew Fitzgerald + * + * @deprecated will be removed in version 2.0 */ -class MigrationsStatusDoctrineCommand extends StatusCommand +class MigrationsStatusDoctrineCommand extends MigrationsStatusCommand { protected function configure() { parent::configure(); - $this - ->setName('mongodb:migrations:status') - ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - CommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm')); - - $configuration = $this->getMigrationConfiguration($input, $output); - CommandHelper::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); + $replacement = str_replace('Doctrine', '', __CLASS__); + $notice = sprintf( + '%s is deprecated and will be removed in 2.0. Use %s instead', + __CLASS__, + $replacement + ); - parent::execute($input, $output); + @trigger_error($notice, E_USER_DEPRECATED); } } diff --git a/Command/MigrationsVersionDoctrineCommand.php b/Command/MigrationsVersionDoctrineCommand.php index 13cd926..a304f35 100644 --- a/Command/MigrationsVersionDoctrineCommand.php +++ b/Command/MigrationsVersionDoctrineCommand.php @@ -11,33 +11,24 @@ namespace AntiMattr\Bundle\MongoDBMigrationsBundle\Command; -use AntiMattr\MongoDB\Migrations\Tools\Console\Command\VersionCommand; -use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; -use Symfony\Component\Console\Output\OutputInterface; - /** * @author Matthew Fitzgerald + * + * @deprecated will be removed in version 2.0 */ -class MigrationsVersionDoctrineCommand extends VersionCommand +class MigrationsVersionDoctrineCommand extends MigrationsVersionCommand { protected function configure() { parent::configure(); - $this - ->setName('mongodb:migrations:version') - ->addOption('dm', null, InputOption::VALUE_OPTIONAL, 'The document manager to use for this command.', 'default_document_manager') - ; - } - - public function execute(InputInterface $input, OutputInterface $output) - { - CommandHelper::setApplicationDocumentManager($this->getApplication(), $input->getOption('dm')); - - $configuration = $this->getMigrationConfiguration($input, $output); - CommandHelper::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); + $replacement = str_replace('Doctrine', '', __CLASS__); + $notice = sprintf( + '%s is deprecated and will be removed in 2.0. Use %s instead', + __CLASS__, + $replacement + ); - parent::execute($input, $output); + @trigger_error($notice, E_USER_DEPRECATED); } }