/** * This acts as a front-controller for phinx. It just instantiates the classes * responsible for parsing the command line from phinx and gives full control of * the rest of the flow to it. * * The input parameter of the ``MigrationDispatcher::run()`` method is manually built * in case a MigrationsShell is dispatched using ``Shell::dispatch()``. * * @return void */ public function main() { $app = new MigrationsDispatcher(PHINX_VERSION); $input = new ArgvInput($this->argv); $app->setAutoExit(false); $app->run($input); }
/** * This acts as a front-controller for phinx. It just instantiates the classes * responsible for parsing the command line from phinx and gives full control of * the rest of the flow to it. * * The input parameter of the ``MigrationDispatcher::run()`` method is manually built * in case a MigrationsShell is dispatched using ``Shell::dispatch()``. * * @return void */ public function main() { $app = new MigrationsDispatcher(PHINX_VERSION); $input = new ArgvInput($this->argv); $app->setAutoExit(false); $exitCode = $app->run($input); if (isset($this->argv[1]) && in_array($this->argv[1], ['migrate', 'rollback']) && $exitCode === 0) { $dispatchCommand = 'migrations dump'; if (!empty($this->params['connection'])) { $dispatchCommand .= ' -c ' . $this->params['connection']; } if (!empty($this->params['plugin'])) { $dispatchCommand .= ' -p ' . $this->params['plugin']; } $this->dispatchShell($dispatchCommand); } }
protected function runMigrations($action = 'migrate', $plugin = null) { $args = ['migrations', $action, '-q']; if ($action == 'rollback') { $args = array_merge($args, ['-t', 0]); } if ($plugin) { $args = array_merge($args, ['--plugin', $plugin]); } //debug($args); $app = new MigrationsDispatcher(PHINX_VERSION); $app->setAutoExit(false); // -q disable verbosing $input = new ArgvInput($args); $app->run($input); }