Aimeos\ShopBundle\Command\SetupCommand::execute PHP Method

execute() protected method

Executes the database initialization and update.
protected execute ( Symfony\Component\Console\Input\InputInterface $input, Symfony\Component\Console\Output\OutputInterface $output )
$input Symfony\Component\Console\Input\InputInterface Input object
$output Symfony\Component\Console\Output\OutputInterface Output object
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $ctx = $this->getContainer()->get('aimeos_context')->get(false, 'command');
        $ctx->setEditor('aimeos:setup');
        $config = $ctx->getConfig();
        $site = $input->getArgument('site');
        $tplsite = $input->getArgument('tplsite');
        $config->set('setup/site', $site);
        $dbconfig = $this->getDbConfig($config);
        $this->setOptions($config, $input);
        $taskPaths = $this->getContainer()->get('aimeos')->get()->getSetupPaths($tplsite);
        $manager = new \Aimeos\MW\Setup\Manager\Multiple($ctx->getDatabaseManager(), $dbconfig, $taskPaths, $ctx);
        $output->writeln(sprintf('Initializing or updating the Aimeos database tables for site <info>%1$s</info>', $site));
        if (($task = $input->getOption('task')) && is_array($task)) {
            $task = reset($task);
        }
        switch ($input->getOption('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"', $input->getOption('action')));
        }
    }