Cml\Console\Commands\Migrate\AbstractCommand::bootstrap PHP Метод

bootstrap() публичный Метод

Bootstrap Phinx.
public bootstrap ( array $args, array $options = [] )
$args array
$options array
    public function bootstrap(array $args, array $options = [])
    {
        if (false === class_exists('\\Phinx\\Config\\Config')) {
            throw new \RuntimeException('please use `composer require linhecheng/cmlphp-ext-phinx` cmd to install phinx.');
        }
        if (!$this->getConfig()) {
            $this->loadConfig($options);
        }
        $this->loadManager($args, $options);
        // report the paths
        Output::writeln('using migration path ' . Colour::colour(str_replace(Cml::getApplicationDir('secure_src'), '{secure_src}', $this->getConfig()->getMigrationPath()), Colour::GREEN));
        Output::writeln('using seed path ' . Colour::colour(str_replace(Cml::getApplicationDir('secure_src'), '{secure_src}', $this->getConfig()->getSeedPath()), Colour::GREEN));
        $exportPath = false;
        if (isset($options['e'])) {
            $exportPath = $options['e'];
        } else {
            if (isset($options['export'])) {
                $exportPath = $options['export'];
            }
        }
        if ($exportPath) {
            is_dir($exportPath) || ($exportPath = $this->getConfig()->getExportPath());
            is_dir($exportPath) || mkdir($exportPath, 0700, true);
            Output::writeln('using export path:' . Colour::colour(str_replace(Cml::getApplicationDir('secure_src'), '{secure_src}', $exportPath), Colour::GREEN));
            $merge = isset($options['m']) || isset($options['merge']) ? 'merge_export_' . date('Y-m-d-H-i-s') . '.sql' : false;
            $this->getManager()->getEnvironment()->setExportPath($exportPath, $merge);
        }
        $this->getConfig()->echoAdapterInfo();
    }