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) { 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} */ public function execute(InputInterface $input, OutputInterface $output) { /** @var Application $application */ $application = $this->getApplication(); DoctrineCommandHelper::setApplicationConnection($application, $input->getOption('db-configuration')); DoctrineCommand::configureMigrations($application->getKernel()->getContainer(), $this->getMigrationConfiguration($input, $output)); 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); }
/** * {@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('filter-expression')) { $arguments['--filter-expression'] = $input->getOption('filter-expression'); } if ($input->getOption('formatted')) { $arguments['--formatted'] = $input->getOption('formatted'); } if ($input->getOption('line-length')) { $arguments['--line-length'] = $input->getOption('line-length'); } $configDir = $this->get('config')->get('[directories][config_dir]'); $arguments['--configuration'] = $configDir . '/migrations.yml'; $command = new DiffCommand(); $command->setHelperSet($helperSet); $returnCode = $command->run(new ArrayInput($arguments), $output); return $returnCode; }
public function execute(InputInterface $input, OutputInterface $output) { DoctrineCommandHelper::setApplicationEntityManager($this->getApplication(), $input->getOption('em')); if ($input->getOption('shard')) { $connection = $this->getApplication()->getHelperSet()->get('db')->getConnection(); if (!$connection instanceof PoolingShardConnection) { throw new \LogicException(sprintf("Connection of EntityManager '%s' must implements shards configuration.", $input->getOption('em'))); } $connection->connect($input->getOption('shard')); } $configuration = $this->getMigrationConfiguration($input, $output); DoctrineCommand::configureMigrations($this->getApplication()->getKernel()->getContainer(), $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();