Since: 2.0
Author: Jonathan Wage (jonwage@gmail.com)
Inheritance: extends AbstractCommand
 public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommand::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     $configuration = $this->getMigrationConfiguration($input, $output);
     DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $configuration);
     parent::execute($input, $output);
 }
 public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommand::setApplicationEntityManager($this->application, $input->getOption('em'));
     $configuration = $this->_getMigrationConfiguration($input, $output);
     DoctrineCommand::configureMigrationsForBundle($this->application, $input->getOption('bundle'), $configuration);
     parent::execute($input, $output);
 }
 /**
  * {@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('show-versions')) {
         $arguments['--show-versions'] = $input->getArgument('show-versions');
     }
     $configDir = $this->get('config')->get('[directories][config_dir]');
     $arguments['--configuration'] = $configDir . '/migrations.yml';
     $command = new StatusCommand();
     $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)
 {
     // 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);
 }
 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);
 }
Example #7
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em'));
     parent::execute($input, $output);
 }
Example #8
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();