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); + } +}