С версии: 2.0
Автор: Jonathan Wage (jonwage@gmail.com)
Наследование: extends AbstractCommand
 public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
     $configuration = $this->getMigrationConfiguration($input, $output);
     DoctrineCommand::configureMigrations($this->application->getKernel()->getContainer(), $configuration);
     parent::execute($input, $output);
 }
Пример #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->get('entity_manager');
     $helperSet = new HelperSet();
     $helperSet->set(new ConnectionHelper($em->getConnection()), 'db');
     $helperSet->set(new EntityManagerHelper($em), 'em');
     $arguments = array();
     if ($input->getOption('editor-cmd')) {
         $arguments['--editor-cmd'] = $input->getOption('editor-cmd');
     }
     $configDir = $this->get('config')->get('[directories][config_dir]');
     $arguments['--configuration'] = $configDir . '/migrations.yml';
     $command = new GenerateCommand();
     $command->setHelperSet($helperSet);
     $returnCode = $command->run(new ArrayInput($arguments), $output);
     return $returnCode;
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var \Pimple\Container $container */
     $container = $this->getHelper('pimple')->getContainer();
     $this->setApplicationEntityManager($container, $this->getApplication(), $input->getOption('em'));
     $configuration = $this->getMigrationConfiguration($input, $output);
     $this->configureMigrations($container, $configuration);
     parent::execute($input, $output);
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     /** @var \Symfony\Bundle\FrameworkBundle\Console\Application $app */
     $app = $this->getApplication();
     /** @var ContainerInterface $container */
     $container = $app->getKernel()->getContainer();
     $this->setMigrationConfiguration($this->getBasicConfiguration($container, $output));
     $configuration = $this->getMigrationConfiguration($input, $output);
     $this->configureMigrations($container, $configuration);
     parent::execute($input, $output);
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     // EM and DB options cannot be set at same time
     if (null !== $input->getOption('em') && null !== $input->getOption('db')) {
         throw new \InvalidArgumentException('Cannot set both "em" and "db" for command execution.');
     }
     Helper\DoctrineCommandHelper::setApplicationHelper($this->getApplication(), $input);
     $configuration = $this->getMigrationConfiguration($input, $output);
     DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
     parent::execute($input, $output);
 }
Пример #6
0
    protected function configure()
    {
        $this->setName('migrations:diff')->setDescription('Generate a migration by comparing your current database to your mapping information.')->addOption('editor-cmd', null, InputOption::PARAMETER_OPTIONAL, 'Open file with this command upon creation.')->setHelp(<<<EOT
The <info>%command.name%</info> command generates a migration by comparing your current database to your mapping information:

    <info>%command.full_name%</info>

You can optionally specify a <comment>--editor-cmd</comment> option to open the generated file in your favorite editor:

    <info>%command.full_name% --editor-cmd=mate</info>
EOT
);
        parent::configure();
    }
Пример #7
0
    protected function configure()
    {
        parent::configure();
        $this->setName('migrations:diff')->setDescription('Generate a migration by comparing your current database to your mapping information.')->setHelp(<<<EOT
The <info>%command.name%</info> command generates a migration by comparing your current database to your mapping information:

    <info>%command.full_name%</info>

You can optionally specify a <comment>--editor-cmd</comment> option to open the generated file in your favorite editor:

    <info>%command.full_name% --editor-cmd=mate</info>
EOT
)->addOption('filter-expression', null, InputOption::VALUE_OPTIONAL, 'Tables which are filtered by Regular Expression.');
    }
Пример #8
0
    protected function configure()
    {
        parent::configure();
        $this->setName('migrations:diff')->setDescription('Generate a migration by comparing your current database to your mapping information.')->setHelp(<<<EOT
The <info>%command.name%</info> command generates a migration by comparing your current database to your mapping information:

    <info>%command.full_name%</info>

You can optionally specify a <comment>--editor-cmd</comment> option to open the generated file in your favorite editor:

    <info>%command.full_name% --editor-cmd=mate</info>
EOT
);
    }
Пример #9
0
 protected function configure()
 {
     parent::configure();
 }
Пример #10
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     parent::execute($input, $output);
 }
Пример #11
0
use Doctrine\DBAL\Migrations\Tools\Console\Command\VersionCommand;
use Doctrine\ORM\Tools\Console\ConsoleRunner;
use Del\Common\ContainerService;
use Del\Common\Config\DbCredentials;
$credentials = new DbCredentials();
$container = ContainerService::getInstance()->setDbCredentials($credentials)->addEntityPath('src/Entity')->getContainer();
// Fetch the entity Manager
$em = $container['doctrine.entity_manager'];
// Create the helperset
$helperSet = ConsoleRunner::createHelperSet($em);
$helperSet->set(new \Symfony\Component\Console\Helper\DialogHelper(), 'dialog');
/** Migrations setup */
$configuration = new Configuration($em->getConnection());
$configuration->setMigrationsDirectory('migrations');
$configuration->setMigrationsNamespace('migrations');
$configuration->setMigrationsTableName('Migration');
//$delmigrate = new Migration();
$diff = new DiffCommand();
$exec = new ExecuteCommand();
$gen = new GenerateCommand();
$migrate = new MigrateCommand();
$status = new StatusCommand();
$ver = new VersionCommand();
$diff->setMigrationConfiguration($configuration);
$exec->setMigrationConfiguration($configuration);
$gen->setMigrationConfiguration($configuration);
$migrate->setMigrationConfiguration($configuration);
$status->setMigrationConfiguration($configuration);
$ver->setMigrationConfiguration($configuration);
$cli = ConsoleRunner::createApplication($helperSet, [$diff, $exec, $gen, $migrate, $status, $ver]);
return $cli->run();