Override 'execute' method to prevent "DDL statements are not allowed in transactions" error.

@param \Symfony\Component\Console\Input\InputInterface $input
@param \Symfony\Component\Console\Output\OutputInterface $output
@return int|void|null
345558
protected function execute(
        \Symfony\Component\Console\Input\InputInterface $input,
        \Symfony\Component\Console\Output\OutputInterface $output
    ) {
        /* bind $output context to log-methods. */
        $this->setOut($output);
        $this->logInfo("Command '" . $this->getName() . "' is started.");
        try {
            $req = new ARequest();
            $this->servClean->exec($req);
        } catch (\Throwable $e) {
            $this->logError("Command '" . $this->getName() . "' failed. Reason: " . $e->getMessage());
        }
        $this->logInfo("Command '" . $this->getName() . "' is completed.");

    }
646660
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);

        $batchSize = NumberUtils::bound($input->getOption('batch-size'), 1, 2000);
        $batchDelay = NumberUtils::bound($input->getOption('batch-delay'), 10, 600000);
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');
        $context['exporting'] = true;
        $qname = $input->getArgument('qname') ? SchemaQName::fromString($input->getArgument('qname')) : null;
        $context['exporting_all'] = null === $qname;

        $i = 0;

        $receiver = function (Node $node) use ($errOutput, $batchSize, $batchDelay, &$i) {
            ++$i;

            try {
                echo json_encode($node) . PHP_EOL;
            } catch (\Exception $e) {
                $errOutput->writeln($e->getMessage());
            }

            if (0 === $i % $batchSize) {
                if ($batchDelay > 0) {
                    usleep($batchDelay * 1000);
                }
            }
        };

        foreach ($this->getSchemasUsingMixin(NodeV1Mixin::create(), (string)$qname ?: null) as $schema) {
            $this->ncr->pipeNodes($schema->getQName(), $receiver, $context);
        }
    }
1372950
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->configureOptions($input);

        $rows = $failed = array();
        foreach ($this->finder->findAll() as $release) {
            $this->locator->setParams(array('release' => $release));
            $scripts = $rollbacks = array();
            $status  = '<fg=green>OK</fg=green>';

            try {
                $scripts   = $this->locator->findScripts();
                $rollbacks = $this->locator->findRollbackScripts();
                $this->checker->check($scripts, $rollbacks);
            } catch (\Exception $e) {
                $status   = sprintf('<fg=red>%s</fg=red>', $e->getMessage());
                $failed[] = $release;
            }

            $rows[] = array($release, count($scripts), count($rollbacks), $status);
        }

        $this->display($output, $rows, $failed);
    }
754815
protected function execute(
        \Symfony\Component\Console\Input\InputInterface $input,
        \Symfony\Component\Console\Output\OutputInterface $output
    ) {
        /* save console output locally (command context) */
        $this->out = $output;
        $this->logInfo("Command '" . $this->getName() . "' is started.");
        $this->conn->beginTransaction();
        try {
            $this->checkAreaCode();
            /* all children must implement 'process' method */
            $this->process($input);
            $this->conn->commit();
        } catch (\Throwable $e) {
            $this->logError("Command '" . $this->getName() . "' failed. Reason: " . $e->getMessage());
            $this->conn->rollBack();
        }
        $this->logInfo("Command '" . $this->getName() . "' is completed.");
    }
1225427
protected function execute(InputInterface $input, OutputInterface $output) : int
    {
        return !is_null($this->exitCode) ? $this->exitCode : 0;
    }
342961
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->cacheService->system()->clear();
        $this->cacheService->user()->clear();
        $output->writeln('Done!');
        return null;
    }
702613
protected function execute(InputInterface $input, OutputInterface $output) {
		if (!file_exists(\Skeleton\Database\Migration\Config::$migration_directory)) {
			$output->writeln('<error>Config::$migration_directory is not set to a valid directory</error>');
			return 1;
		}

		$migration = \Skeleton\Database\Migration::get_by_version($input->getArgument('name'));

		try {
			$migration->up();
			$output->writeln(get_class($migration) . "\t" . ' <info>ok</info>');
		} catch (\Exception $e) {
			$output->writeln(get_class($migration) . "\t" . ' <error>' . $e->getMessage() . '</error>');
			$output->writeln('<comment>' . $e->getTraceAsString() . '</comment>');
			return 1;
		}

		return 0;
	}
1365760
protected function execute(InputInterface $input, OutputInterface $output)
    {
        foreach ($this->getFacade()->migrate() as $line) {
            $output->write($line);
        }
    }
821227
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = new SymfonyOutput($output);

        $this->input = $input;

        if (method_exists($this, 'handle')) {
            $this->handle();
        }
    }
85354
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);
        $this->relation = $input->getArgument('relation');
    }
1014081
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);

        $this->setOutput($output);
        $this->setVerbosity($output->getVerbosity());

        if ($input->getOption('child') && $output->getVerbosity() <= OutputInterface::VERBOSITY_NORMAL) {
            $this->setVerbosity(self::VERBOSITY_CHILD);
        }

        $this->getContainer()->get('ez_migration_bundle.step_executed_listener.tracing')->setOutput($output);

        $migrationService = $this->getMigrationService();

        $force = $input->getOption('force');

        $toExecute = $this->buildMigrationsList($input->getOption('path'), $migrationService, $force);

        if (!count($toExecute)) {
            $output->writeln('<info>No migrations to execute</info>');
            return 0;
        }

        $this->printMigrationsList($toExecute, $input, $output);

        if (!$input->getOption('child')) {
            // ask user for confirmation to make changes
            if (!$this->askForConfirmation($input, $output)) {
                return 0;
            }
        }

        if ($input->getOption('separate-process')) {
            $builder = new ProcessBuilder();
            $executableFinder = new PhpExecutableFinder();
            if (false !== $php = $executableFinder->find()) {
                $builder->setPrefix($php);
            }
            $builderArgs = $this->createChildProcessArgs($input);
        }

        // For cli scripts, this means: do not die if anyone yanks out our stdout.
        if ($input->getOption('survive-disconnected-tty')) {
            ignore_user_abort(true);
        }

        // allow forcing handling of sigchild. Useful on eg. Debian and Ubuntu
        if ($input->getOption('force-sigchild-enabled')) {
            Process::forceSigchildEnabled(true);
        }

        $aborted = false;
        $executed = 0;
        $failed = 0;
        $skipped = 0;
        $total = count($toExecute);

        /** @var MigrationDefinition $migrationDefinition */
        foreach ($toExecute as $name => $migrationDefinition) {

            // let's skip migrations that we know are invalid - user was warned and he decided to proceed anyway
            if ($migrationDefinition->status == MigrationDefinition::STATUS_INVALID) {
                $output->writeln("<comment>Skipping $name</comment>");
                $skipped++;
                continue;
            }

            $this->writeln("<info>Processing $name</info>");

            if ($input->getOption('separate-process')) {

                try {
                    $this->executeMigrationInSeparateProcess($migrationDefinition, $migrationService, $builder, $builderArgs);

                    $executed++;
                } catch (\Exception $e) {
                    $failed++;


                    $errorMessage = $e->getMessage();
                    // we probably have already echoed the error message while the subprocess was executing, avoid repeating it
                    if ($errorMessage != $this->subProcessErrorString) {
                        if ($e instanceof AfterMigrationExecutionException) {
                            $errorMessage = "Failure after migration end! Reason: " . $errorMessage;
                        } else {
                            $errorMessage = "Migration failed! Reason: " . $errorMessage;
                        }

                        $this->writeErrorln("\n<error>$errorMessage</error>");
                    }

                    if (!$input->getOption('ignore-failures')) {
                        $aborted = true;
                        break;
                    }
                }

            } else {

                try {
                    $this->executeMigrationInProcess($migrationDefinition, $force, $migrationService, $input);

                    $executed++;
                } catch (\Exception $e) {
                    $failed++;

                    $this->writeErrorln("\n<error>Migration failed! Reason: " . $e->getMessage() . "</error>");

                    if (!$input->getOption('ignore-failures')) {
                        $aborted = true;
                        break;
                    }
                }

            }
        }

        $missed = $total - $executed - $failed - $skipped;

        if ($aborted) {
            if ($missed > 0) {
                $this->writeErrorln("\n<error>Migration execution aborted</error>");
            }
        } else {
            // NB: as per the Sf doc at https://symfony.com/doc/2.7/console/calling_commands.html, the 'cache:clear'
            // command should be run 'at the end', as they change some class definitions
            if ($input->getOption('clear-cache')) {
                $command = $this->getApplication()->find('cache:clear');
                $inputArray = new ArrayInput(array('command' => 'cache:clear'));
                $command->run($inputArray, $output);
            }
        }

        $this->writeln("\nExecuted $executed migrations, failed $failed, skipped $skipped" . ($missed ? ", missed $missed" : ''));

        $time = microtime(true) - $start;
        if ($input->getOption('separate-process')) {
            // in case of using subprocesses, we can not measure max memory used
            $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs</info>");
        } else {
            $this->writeln("<info>Time taken: ".sprintf('%.2f', $time)." secs, memory: ".sprintf('%.2f', (memory_get_peak_usage(true) / 1000000)). ' MB</info>');
        }

        return $failed;
    }
306872
protected function execute(InputInterface $input, OutputInterface $output)
    {
        //  validate the content types unless validation is ignored

        if ($input->getArgument('id') && !$input->getOption('ignore')) {
            $code = $this->executeValidation($input, $output);

            if ($code) {
                return $code;
            }
        }

        if ($input->getOption('delete')) {
            return $this->executeDelete($input, $output);
        }

        if (!$input->getArgument('id') && !$input->getOption('full')) {
            throw new InvalidArgumentException(
                'You need to give one or more content types or choose the --full or --delete option'
            );
        }

        return $this->executeIndex($input, $output);
    }
253617
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->entityManager->getConnection()->beginTransaction();

        try {
            $this->entityManager->getConnection()->exec(
                'UPDATE menu_item ' .
                'INNER JOIN url_alias ON menu_item.path = url_alias.public_url ' .
                'SET menu_item.path = url_alias.internal_url'
            );

            $this->entityManager->getConnection()->commit();
        } catch (\Exception $exception) {
            $this->entityManager->getConnection()->rollBack();

            throw $exception;
        }
    }
455101
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->env = $input->getOption('env');
        $this->registry = $this->getContainer()->get('doctrine');
        $this->output = $output;

        $this->runCrons();
    }
55634
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = microtime(true);
        $commands = array('qa:cbf', 'qa:csf');
        $style = new SymfonyStyle($input, $output);
        $style->setDecorated(true);
        $output->write(sprintf("\033\143"));

        foreach ($commands as $command) {
            $returnCode = $this->getApplication()->find($command)->run($input, $output);
            if ($returnCode) {
                $output->writeln('<error>Exit code '.$returnCode.'</>');
            }
        }

        $end = microtime(true);
        $time = round($end - $start);
        $style->newLine();
        $style->section('Results');
        $output->writeln('<info>Time: '.$time.' seconds</>');
    }
946925
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $errOutput = $output instanceof ConsoleOutputInterface ? $output->getErrorOutput() : $output;
        $output->setVerbosity(OutputInterface::VERBOSITY_QUIET);
        $errOutput->setVerbosity(OutputInterface::VERBOSITY_NORMAL);

        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');

        $nodeRef = NodeRef::fromString($input->getArgument('node-ref'));
        $consistent = $input->getOption('consistent') ? true : false;

        try {
            $node = $this->ncr->getNode($nodeRef, $consistent, $context);
            echo json_encode($node, $input->getOption('pretty') ? JSON_PRETTY_PRINT : 0) . PHP_EOL;
        } catch (\Throwable $e) {
            $errOutput->writeln($e->getMessage());
        }
    }
391571
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        $info = $this
            ->getSession()
            ->getInspector()
            ->getSchemaRelations($this->fetchSchemaOid()
        );
        $this->formatOutput($output, $info);
    }