vendor/bundles/Symfony/Bundle/DoctrineMigrationsBundle/Command/MigrationsDiffDoctrineCommand.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\DiffCommand;
       
    19 
       
    20 /**
       
    21  * Command for generate migration classes by comparing your current database schema
       
    22  * to your mapping information.
       
    23  *
       
    24  * @author Fabien Potencier <fabien@symfony.com>
       
    25  * @author Jonathan H. Wage <jonwage@gmail.com>
       
    26  */
       
    27 class MigrationsDiffDoctrineCommand extends DiffCommand
       
    28 {
       
    29     protected function configure()
       
    30     {
       
    31         parent::configure();
       
    32 
       
    33         $this
       
    34             ->setName('doctrine:migrations:diff')
       
    35             ->addOption('em', null, InputOption::VALUE_OPTIONAL, 'The entity manager to use for this command.')
       
    36         ;
       
    37     }
       
    38 
       
    39     public function execute(InputInterface $input, OutputInterface $output)
       
    40     {
       
    41         DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
       
    42 
       
    43         $configuration = $this->getMigrationConfiguration($input, $output);
       
    44         DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
       
    45 
       
    46         parent::execute($input, $output);
       
    47     }
       
    48 }