@param InputInterface  $input
@param OutputInterface $output

@return int|null|void
@throws DoctrineStaticMetaException
354174
public function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $output->writeln(
                '<comment>Setting relation: '
                . $input->getOption(static::OPT_ENTITY1)
                . ' ' . $input->getOption(static::OPT_HAS_TYPE)
                . ' ' . $input->getOption(static::OPT_ENTITY2)
                . '</comment>'
            );
            $this->checkOptions($input);
            $hasType = $input->getOption(static::OPT_HAS_TYPE);
            if (!\in_array($hasType, RelationsGenerator::HAS_TYPES, true)) {
                $hasType = RelationsGenerator::PREFIX_OWNING . $hasType;
                if (!\in_array($hasType, RelationsGenerator::HAS_TYPES, true)) {
                    throw new DoctrineStaticMetaException(
                        'Invalid hasType ' . $input->getOption(static::OPT_HAS_TYPE)
                        . ' Must be one of ' . print_r(RelationsGenerator::HAS_TYPES, true)
                    );
                }
            }
            $this->relationsGenerator
                ->setPathToProjectRoot($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_PATH))
                ->setProjectRootNamespace($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_NAMESPACE));

            $this->relationsGenerator->setEntityHasRelationToEntity(
                $input->getOption(static::OPT_ENTITY1),
                $hasType,
                $input->getOption(static::OPT_ENTITY2),
                \in_array($input->getOption(self::OPT_REQUIRED_RELATION), ['1', 1, 'true', true], true)
            );
            $output->writeln('<info>completed</info>');
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
80176
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (null === $this->em) {
            $this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
        }

        $roleName = strtoupper($input->getArgument('role'));
        if ('ROLE_' != substr($roleName, 0, 5)) {
            $roleName = 'ROLE_' . $roleName;
        }

        $role = new Role($roleName);
        $this->em->persist($role);
        $this->em->flush();

        $output->writeln(sprintf('Created role <comment>%s</comment>', $roleName));
    }
474696
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (null === $this->em) {
            $this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
        }

        // get params
        $configId = false;
        $segmentId = false;

        try {
            $configId = $input->getOption('config');
            $segmentId = $input->getOption('segment');
        } catch (\Exception $e) {
        }

        try {
            if ($segmentId) {
                $this->generateOverviewsOfSegment($segmentId);
            } else {
                if ($configId) {
                    $this->generateOverviewsOfConfig($configId);
                } else {
                    $this->generateAllOverviews();
                }
            }

            $output->writeln('<fg=green>Overviews succesfully generated</fg=green>');
        } catch (\InvalidArgumentException $e) {
            $output->writeln('<fg=red>' . $e->getMessage() . '</fg=red>');
        }
    }
626709
protected function execute(InputInterface $input, OutputInterface $output) : void
    {

        $io     = $this->getIO($input, $output);
        $config = $this->getConfig($input->getOption('configuration'), true);
        $repo   = new Repository(dirname($input->getOption('git-directory')));

        $installer = new Installer($io, $config, $repo);
        $installer->setForce($input->getOption('force'))
                  ->setHook((string) $input->getArgument('hook'));

        $installer->run();
    }
1176625
public function execute(InputInterface $input, OutputInterface $output)
    {
        if (($destPath = $input->getOption('dest-path')) === null) {
            $destPath = 'config';
        }

        if (($author = $input->getArgument('author')) === null) {
            throw new InvalidArgumentException('Missing author option');
        }

        if (($sourceFilePath = $input->getOption('source-file')) === null) {
            $sourceFilePath = 'config/doctrine.php';
        }

        $destPath = realpath($destPath);

        if (!is_dir($destPath)) {
            mkdir($destPath, 0777, true);
        }

        if (!is_writable($destPath)) {
            throw new InvalidArgumentException(
                sprintf("Configuration destination directory '<info>%s</info>' does not have write permissions.",
                    $destPath)
            );
        }

        $destFilePath = $destPath . '/doctrine.generated.php';

        $originalSourceFilePath = $sourceFilePath;
        $sourceFilePath         = realPath($sourceFilePath);

        if (!file_exists($sourceFilePath)) {
            throw new InvalidArgumentException(
                sprintf("Source file at path '<info>%s</info>' does not exist.",
                    $originalSourceFilePath)
            );
        }

        $sourceArrayConfig = include $sourceFilePath;

        $viewFactory = $this->createViewFactory();

        $className = __NAMESPACE__ . '\ConfigMigrations\\' . ucfirst($author) . 'Migrator';

        if (!class_exists($className)) {
            throw new InvalidArgumentException('Author provided was not a valid choice.');
        } else {
            $configMigrator        = new $className($viewFactory);
            $convertedConfigString = $configMigrator->convertConfiguration($sourceArrayConfig);
        }

        file_put_contents($destFilePath, '<?php ' . $convertedConfigString);

        $output->writeln('Conversion successful. File generated at ' . $destFilePath);
    }
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;
    }
1188387
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->input = $input;
        $this->output = $output;
        $io = new SymfonyStyle($input, $output);

        $config = $this->getConfigHelper()->load($input);
        $typeMap = TypeMap::fromMetadata(
            $config->getTypeNamespace(),
            $config->getEngine()->getMetadata()->getTypes()
        );

        $generator = new ClassMapGenerator(
            $config->getRuleSet(),
            $config->getClassMapName(),
            $config->getClassMapNamespace()
        );
        $path = $config->getClassMapDestination().DIRECTORY_SEPARATOR.$config->getClassMapName().'.php';
        $this->handleClassmap($generator, $typeMap, $path);

        $io->success('Generated classmap at ' . $path);
    }
975468
public function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $output->writeln(
                '<comment>Generating new Embeddable  '
                . $input->getOption(static::OPT_NEW_EMBEDDABLE_CLASS_NAME)
                . ' from archetype ' . $input->getOption(static::OPT_ARCHETYPE_OBJECT_FQN)
                . '</comment>'
            );
            $this->checkOptions($input);
            $this->embeddableGenerator
                ->setPathToProjectRoot($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_PATH))
                ->setProjectRootNamespace($input->getOption(AbstractCommand::OPT_PROJECT_ROOT_NAMESPACE))
                ->createFromArchetype(
                    $input->getOption(static::OPT_ARCHETYPE_OBJECT_FQN),
                    $input->getOption(static::OPT_NEW_EMBEDDABLE_CLASS_NAME)
                );
            $output->writeln('<info>completed</info>');
        } catch (\Exception $e) {
            throw new DoctrineStaticMetaException(
                'Exception in ' . __METHOD__ . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
    }
69036
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $root = $this->getContainer()->getParameter('kernel.root_dir');
        chdir("$root/..");
        $path = "$root/Resources/gettext/messages.pot";
        $languages = $input->getArgument('languages');
        $results = $this->initializeFromTemplate($path, $languages);
        foreach ($results as $filename => $status) {
            $output->writeln("$status: $filename");
        }
    }
314
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->init($input);
        $function = $input->getArgument('function');
        $idChart  = $input->getOption('idChart');

        switch ($function) {
            case 'maj-player':
                if ($idChart) {
                    $chart = $this->doctrine->getRepository('VideoGamesRecordsCoreBundle:Chart')->find($idChart);
                    $this->updateCharts([$chart]);
                } else {
                    $this->majPlayer($output);
                }
                break;
        }
        $this->end($output);

        return true;
    }
102157
public function run(InputInterface $input, OutputInterface $output): ?int
    {
        $return = $this->execute($input, $output);
        if (null === $return) {
            $return = EdgarCronRepository::STATUS_OK;
        }

        return $return;
    }
460060
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (null === $this->em) {
            $this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
        }

        if (null === $this->serviceHelper) {
            $this->serviceHelper = $this->getContainer()->get('kunstmaan_dashboard.helper.google.analytics.service');
        }

        $this->output = $output;

        // check if token is set
        $configHelper = $this->getContainer()->get('kunstmaan_dashboard.helper.google.analytics.config');
        if (!$configHelper->tokenIsSet()) {
            $this->output->writeln('You haven\'t configured a Google account yet');

            return;
        }

        // get params
        $configId = false;
        $segmentId = false;
        $overviewId = false;

        try {
            $configId = $input->getOption('config');
            $segmentId = $input->getOption('segment');
            $overviewId = $input->getOption('overview');
        } catch (\Exception $e) {
        }

        // get the overviews
        try {
            $overviews = [];

            if ($overviewId) {
                $overviews[] = $this->getSingleOverview($overviewId);
            } elseif ($segmentId) {
                $overviews = $this->getOverviewsOfSegment($segmentId);
            } elseif ($configId) {
                $overviews = $this->getOverviewsOfConfig($configId);
            } else {
                $overviews = $this->getAllOverviews();
            }

            // update the overviews
            $this->updateData($overviews);
            $result = '<fg=green>Google Analytics data updated with <fg=red>'.$this->errors.'</fg=red> error';
            $result .= $this->errors != 1 ? 's</fg=green>' : '</fg=green>';
            $this->output->writeln($result); // done
        } catch (\Exception $e) {
            $this->output->writeln($e->getMessage());
        }
    }
435391
protected function execute(InputInterface $input, OutputInterface $output)
    {	
    	$post = new PostBuilder(
            $this->filesystem,
            $input->getArgument('title'),
            $input->getOption('m')
        );

        $post->build();

        $output->writeln(

            sprintf("<info>Post \"%s\" was generated successfully.</info>", $input->getArgument('title'))
        );
    }
1357010
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $autopopulate = $input->getOption('autopopulate');
        $typeId = $input->getArgument('type');
        $nodeCode = $input->getArgument('node');
        $this->em = $this->getContainer()->get('doctrine')->getManager();

        if (null === ($type = $this->getNodeTypeManager()->find($typeId))) {
            $output->writeln('<error>Unknown node type</error>');

            return;
        }
        if (null === ($node = $this->getNodeManager()->findOneBy(array('code' => $nodeCode)))) {
            $output->writeln('<error>Unknown node</error>');

            return;
        }

        if ($autopopulate) {
            $startDate = 1429566600 ;
            $currDate = $startDate;
            $now = time();
            $currData = 1500;
            // Initialize first data
            switch ($type->getUnit()) {
                case '%':
                    $currData = mt_rand(4000,6000);
                break;
            }

            // Populate data
            while ($currDate < $now) {
                $nodeData = new NodeData();
                $cleanDate = \DateTime::createFromFormat("U", $currDate);

                switch ($type->getUnit()) {
                    case '°C':
                        if (date("H", $currDate) == 0) { $currData = mt_rand(1450, 1650); } else {
                            $currData += mt_rand(10,50);
                        }
                    break;
                    case '%':
                        if (date("H", $currDate) == 0 || $currData >= 10000) { $currData = mt_rand(4000, 6000); } else { $currData += mt_rand(10, 50); }
                    break;
                }

                $nodeData->setType($type);
                $nodeData->setNode($node);
                $nodeData->setCreated($cleanDate);
                $nodeData->setData($currData);
                $this->em->persist($nodeData);
                $currDate += 1000;
            }
            $this->em->flush();
        }
    }
11912
protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $builder = $this->getMenuBuilder($input, $output);
        if ($input->getOption('dump')) {
            $this->dumpCommands($builder, $output);
        } else {
            $builder->build()->open();
        }
        return 0;
    }
1256620
protected function execute(InputInterface $input, OutputInterface $output): void
    {
        $output->writeln([
            '----------------',
            'Domain entity generator',
            '----------------',
            ''
        ]);

        $helper      = $this->getHelper('question');
        $questionSet = $this->createQuestionSet();
        $entityName  = $helper->ask($input, $output, $questionSet['entityName']);

        do {
            $propertyNames[] = $helper->ask($input, $output, $questionSet['propertyName']);
            $propertyTypes[] = $helper->ask($input, $output, $questionSet['propertyType']);
        } while ($helper->ask($input, $output, $questionSet['continue']));

        $properties = array_combine($propertyNames, $propertyTypes);

        $configuration   = $this->appConfiguration->getConfiguration();
        $entityNamespace = $configuration['framework']['root_namespace'] . 'Domain\Entity';

        $entityData = [
            'namespace'  => $entityNamespace,
            'class'      => $entityName,
            'properties' => $properties
        ];

        (new EntityGenerator($entityData))->generate();

        $output->writeln('Entity generated successfully!');
    }
323992
protected function execute(InputInterface $input, OutputInterface $output)
	{
		$this->setupEnvironment('site', $input, $output);

		$version = new \JVersion;

		if ($input->getOption('short'))
		{
			$result = $version->getShortVersion();
		}
		elseif ($input->getOption('release'))
		{
			$result = $version->RELEASE;
		}
		else
		{
			$result = $version->getLongVersion();
		}
		$output->writeln($result);
	}