Aimeos\Shop\Command\SetupCommand::fire PHP Method

fire() public method

Execute the console command.
public fire ( ) : mixed
return mixed
    public function fire()
    {
        $ctx = $this->getLaravel()->make('\\Aimeos\\Shop\\Base\\Context')->get(false, 'command');
        $ctx->setEditor('aimeos:setup');
        $config = $ctx->getConfig();
        $site = $this->argument('site');
        $template = $this->argument('tplsite');
        $config->set('setup/site', $site);
        $dbconfig = $this->getDbConfig($config);
        $this->setOptions($config);
        $taskPaths = $this->getLaravel()->make('\\Aimeos\\Shop\\Base\\Aimeos')->get()->getSetupPaths($template);
        $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
        $this->info(sprintf('Initializing or updating the Aimeos database tables for site "%1$s"', $site));
        if (($task = $this->option('task')) && is_array($task)) {
            $task = reset($task);
        }
        switch ($this->option('action')) {
            case 'migrate':
                $manager->migrate($task);
                break;
            case 'rollback':
                $manager->rollback($task);
                break;
            case 'clean':
                $manager->clean($task);
                break;
            default:
                throw new \Exception(sprintf('Invalid setup action "%1$s"', $this->option('action')));
        }
    }