vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsExecuteDoctrineCommand.php
changeset 39 03b14b0fe101
equal deleted inserted replaced
38:bbdc7f9aa25e 39:03b14b0fe101
       
     1 <?php
       
     2 
       
     3 /*
       
     4  * This file is part of the Symfony package.
       
     5  *
       
     6  * (c) Fabien Potencier <fabien@symfony.com>
       
     7  *
       
     8  * For the full copyright and license information, please view the LICENSE
       
     9  * file that was distributed with this source code.
       
    10  */
       
    11 
       
    12 namespace Symfony\Bundle\DoctrineMigrationsBundle\Command;
       
    13 
       
    14 use Symfony\Component\Console\Input\InputInterface;
       
    15 use Symfony\Component\Console\Output\OutputInterface;
       
    16 use Symfony\Component\Console\Input\InputOption;
       
    17 use Symfony\Bundle\DoctrineBundle\Command\Proxy\DoctrineCommandHelper;
       
    18 use Doctrine\DBAL\Migrations\Tools\Console\Command\ExecuteCommand;
       
    19 
       
    20 /**
       
    21  * Command for executing single migrations up or down manually.
       
    22  *
       
    23  * @author Fabien Potencier <fabien@symfony.com>
       
    24  * @author Jonathan H. Wage <jonwage@gmail.com>
       
    25  */
       
    26 class MigrationsExecuteDoctrineCommand extends ExecuteCommand
       
    27 {
       
    28     protected function configure()
       
    29     {
       
    30         parent::configure();
       
    31 
       
    32         $this
       
    33             ->setName('doctrine:migrations:execute')
       
    34             ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.')
       
    35         ;
       
    36     }
       
    37 
       
    38     public function execute(InputInterface $input, OutputInterface $output)
       
    39     {
       
    40         DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
       
    41 
       
    42         $configuration = $this->getMigrationConfiguration($input, $output);
       
    43         DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
       
    44 
       
    45         parent::execute($input, $output);
       
    46     }
       
    47 }