Beispiel #1
0
 public function handle(InputInterface $input, OutputInterface $output)
 {
     $registry = BaseOrm::getRegistry();
     $loader = new Loader();
     $issues = $loader->detectConflicts();
     if (!empty($issues)) {
         $message = 'The following migrations seem to indicate they are both the latest migration :' . PHP_EOL;
         $message .= ' %s ' . PHP_EOL;
         $output->writeln(sprintf($message, Tools::stringify($issues)));
         return;
     }
     if ($input->getOption('no-interaction')) {
         $asker = NonInteractiveAsker::createObject($input, $output);
     } else {
         $asker = InteractiveAsker::createObject($input, $output);
     }
     $autodetector = new AutoDetector($loader->getProjectState(), ProjectState::fromApps($registry), $asker);
     $changes = $autodetector->getChanges($loader->graph);
     if (empty($changes)) {
         $output->writeln('No changes were detected');
         return;
     }
     if ($input->getOption('dry-run')) {
         $output->writeln('<info>Migrations :</info>');
         /** @var $migration Migration */
         foreach ($changes as $migration) {
             $output->writeln('  -- ' . $migration->getName());
         }
         return;
     }
     $this->_writeMigrations($changes, $input, $output);
 }
Beispiel #2
0
 /**
  * Executor constructor.
  *
  * @param Connection $connection
  */
 public function __construct($connection)
 {
     $this->connection = $connection;
     $this->schemaEditor = SchemaEditor::createObject($connection);
     $this->loader = Loader::createObject($connection);
     $this->recorder = Recorder::createObject($connection);
 }