From 6d2bd34ad8ee22578f86c4150f19debc14c75bfe Mon Sep 17 00:00:00 2001 From: Denis Togbe Date: Wed, 18 Dec 2013 17:29:22 +0100 Subject: [PATCH] Add command for outputting the latest version number --- Command/MigrationsLatestDoctrineCommand.php | 50 +++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 Command/MigrationsLatestDoctrineCommand.php diff --git a/Command/MigrationsLatestDoctrineCommand.php b/Command/MigrationsLatestDoctrineCommand.php new file mode 100644 index 0000000..7309be7 --- /dev/null +++ b/Command/MigrationsLatestDoctrineCommand.php @@ -0,0 +1,50 @@ + + * (c) Doctrine Project, Benjamin Eberlei + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Doctrine\Bundle\MigrationsBundle\Command; + +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Output\OutputInterface; +use Symfony\Component\Console\Input\InputOption; +use Doctrine\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper; +use Doctrine\DBAL\Migrations\Tools\Console\Command\LatestCommand; + +/** + * Command for outputting the latest version number. + * + * @author Fabien Potencier + * @author Jonathan H. Wage + */ +class MigrationsLatestDoctrineCommand extends LatestCommand +{ + protected function configure() + { + parent::configure(); + + $this + ->setName('doctrine:migrations:latest') + ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.') + ; + } + + public function execute(InputInterface $input, OutputInterface $output) + { + DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); + + $configuration = $this->getMigrationConfiguration($input, $output); + DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration); + + parent::execute($input, $output); + } +}