/** * {@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'); $helperSet->set($this->getHelper('dialog'), 'dialog'); $arguments = array(); if ($input->getArgument('version')) { $arguments['version'] = $input->getArgument('version'); } if ($input->getOption('write-sql')) { $arguments['--write-sql'] = $input->getOption('write-sql'); } if ($input->getOption('dry-run')) { $arguments['--dry-run'] = $input->getOption('dry-run'); } if ($input->getOption('query-time')) { $arguments['--query-time'] = $input->getOption('query-time'); } if ($input->getOption('allow-no-migration')) { $arguments['--allow-no-migration'] = $input->getOption('allow-no-migration'); } $configDir = $this->get('config')->get('[directories][config_dir]'); $arguments['--configuration'] = $configDir . '/migrations.yml'; $command = new MigrateCommand(); $command->setHelperSet($helperSet); $returnCode = $command->run(new ArrayInput($arguments), $output); return $returnCode; }
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); }
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); }
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) { if ($path = $input->getArgument('vendor')) { $path = 'vendor/' . $path . '/migrations'; $config = $this->getMigrationConfiguration($input, $output); $config->setMigrationsDirectory($path); $config->registerMigrationsFromDirectory($path); $this->setMigrationConfiguration($config); } 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); }
public function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); parent::execute($input, $output); }
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();