title() public method

public title ( $message )
コード例 #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $name = $input->getArgument('name');
     if (empty($name)) {
         $io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
         $io->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $container = $this->compileContainer();
     $configs = $container->getExtensionConfig($extension->getAlias());
     $configuration = $extension->getConfiguration($configs, $container);
     $this->validateConfiguration($extension, $configuration);
     $configs = $container->getParameterBag()->resolveValue($configs);
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     if ($name === $extension->getAlias()) {
         $io->title(sprintf('Current configuration for extension with alias "%s"', $name));
     } else {
         $io->title(sprintf('Current configuration for "%s"', $name));
     }
     $io->writeln(Yaml::dump(array($extension->getAlias() => $config), 3));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     if (false !== strpos($input->getFirstArgument(), ':d')) {
         $io->caution('The use of "config:debug" command is deprecated since version 2.7 and will be removed in 3.0. Use the "debug:config" instead.');
     }
     $name = $input->getArgument('name');
     if (empty($name)) {
         $io->comment('Provide the name of a bundle as the first argument of this command to dump its configuration.');
         $io->newLine();
         $this->listBundles($output);
         return;
     }
     $extension = $this->findExtension($name);
     $container = $this->compileContainer();
     $configs = $container->getExtensionConfig($extension->getAlias());
     $configuration = $extension->getConfiguration($configs, $container);
     $this->validateConfiguration($extension, $configuration);
     $configs = $container->getParameterBag()->resolveValue($configs);
     $processor = new Processor();
     $config = $processor->processConfiguration($configuration, $configs);
     if ($name === $extension->getAlias()) {
         $io->title(sprintf('Current configuration for extension with alias "%s"', $name));
     } else {
         $io->title(sprintf('Current configuration for "%s"', $name));
     }
     $io->writeln(Yaml::dump(array($extension->getAlias() => $config), 10));
 }
コード例 #3
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $allJournals = $this->getAllJournals();
     $this->io->progressStart(count($allJournals));
     foreach ($allJournals as $journal) {
         $this->normalizeLastIssuesByJournal($journal);
     }
 }
コード例 #4
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io = new SymfonyStyle($input, $output);
     $this->locale = $this->getContainer()->getParameter('locale');
     $this->io->title('Import normalize translatable objects.');
     $this->normalizeSubjects();
     $this->normalizePublisherTypes();
     $this->normalizePeriods();
 }
コード例 #5
0
ファイル: ApiDocsDumpCommand.php プロジェクト: ojs/ojs
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     foreach ($this->apiViews as $apiView) {
         $bufferOutput = new BufferedOutput();
         $this->application->run(new StringInput(sprintf('api:doc:dump --view=%s', $apiView)), $bufferOutput);
         $viewDump = $bufferOutput->fetch();
         $viewDumpFile = __DIR__ . '/../Resources/doc/' . $apiView . '-api-doc.md';
         file_put_contents($viewDumpFile, $viewDump);
         $this->io->writeln(sprintf("%s -> view dumped to %s", $apiView, $viewDumpFile));
     }
 }
コード例 #6
0
ファイル: UserListByRolesCommand.php プロジェクト: ojs/ojs
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $roles = explode(',', $input->getArgument('roles'));
     if (!is_array($roles) || count($roles) < 1) {
         throw new \LogicException('Specify min. 1 role');
     }
     $users = $this->em->getRepository('OjsUserBundle:User')->findUsersByJournalRole($roles);
     $this->io->writeln('"user_id", "username", "first_name", "last_name", "email"');
     /** @var User $user */
     foreach ($users as $user) {
         $this->io->writeln(sprintf('%s, "%s", "%s", "%s", "%s"', $user->getId(), $user->getUsername(), $user->getFirstName(), $user->getLastName(), $user->getEmail()));
     }
 }
コード例 #7
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->allJournals));
     $counter = 1;
     foreach ($this->allJournals as $journal) {
         $this->normalizeSetting($journal);
         $this->io->progressAdvance(1);
         $counter = $counter + 1;
         if ($counter % 50 == 0) {
             $this->em->flush();
         }
     }
     $this->em->flush();
 }
コード例 #8
0
ファイル: DeleteJournalCommand.php プロジェクト: ojs/ojs
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return int|null|void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->text("removing articles\n");
     $this->removeArticles();
     $this->io->newLine(2);
     $this->io->text("refresh journal and remove issues\n");
     $this->removeIssues($input);
     $this->io->newLine(1);
     $this->io->text("refresh journal and remove journal totally");
     $this->refreshJournal($input);
     $this->em->remove($this->journal);
     $this->em->flush();
     $this->io->success('successfully removed journal');
 }
コード例 #9
0
 /**
  * Executes the command to
  * - optionally update the reference index (to have clean data)
  * - find files within uploads/* which are not connected to the reference index
  * - remove these files if --dry-run is not set
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title($this->getDescription());
     $dryRun = $input->hasOption('dry-run') && $input->getOption('dry-run') != false ? true : false;
     $this->updateReferenceIndex($input, $io);
     // Find the lost files
     if ($input->hasOption('exclude') && !empty($input->getOption('exclude'))) {
         $excludedPaths = GeneralUtility::trimExplode(',', $input->getOption('exclude'), true);
     } else {
         $excludedPaths = [];
     }
     $lostFiles = $this->findLostFiles($excludedPaths);
     if (count($lostFiles)) {
         if (!$io->isQuiet()) {
             $io->note('Found ' . count($lostFiles) . ' lost files, ready to be deleted.');
             if ($io->isVerbose()) {
                 $io->listing($lostFiles);
             }
         }
         // Delete them
         $this->deleteLostFiles($lostFiles, $dryRun, $io);
         $io->success('Deleted ' . count($lostFiles) . ' lost files.');
     } else {
         $io->success('Nothing to do, no lost files found');
     }
 }
コード例 #10
0
 /**
  * @throws \InvalidArgumentException When route does not exist
  */
 protected function outputMailer($name)
 {
     try {
         $service = sprintf('swiftmailer.mailer.%s', $name);
         $mailer = $this->getContainer()->get($service);
     } catch (ServiceNotFoundException $e) {
         throw new \InvalidArgumentException(sprintf('The mailer "%s" does not exist.', $name));
     }
     $tableHeaders = array('Property', 'Value');
     $tableRows = array();
     $transport = $mailer->getTransport();
     $spool = $this->getContainer()->getParameter(sprintf('swiftmailer.mailer.%s.spool.enabled', $name)) ? 'YES' : 'NO';
     $delivery = $this->getContainer()->getParameter(sprintf('swiftmailer.mailer.%s.delivery.enabled', $name)) ? 'YES' : 'NO';
     $singleAddress = $this->getContainer()->getParameter(sprintf('swiftmailer.mailer.%s.single_address', $name));
     $this->io->title(sprintf('Configuration of the Mailer "%s"', $name));
     if ($this->isDefaultMailer($name)) {
         $this->io->comment('This is the default mailer');
     }
     $tableRows[] = array('Name', $name);
     $tableRows[] = array('Service', $service);
     $tableRows[] = array('Class', get_class($mailer));
     $tableRows[] = array('Transport', sprintf('%s (%s)', sprintf('swiftmailer.mailer.%s.transport.name', $name), get_class($transport)));
     $tableRows[] = array('Spool', $spool);
     if ($this->getContainer()->hasParameter(sprintf('swiftmailer.spool.%s.file.path', $name))) {
         $tableRows[] = array('Spool file', $this->getContainer()->getParameter(sprintf('swiftmailer.spool.%s.file.path', $name)));
     }
     $tableRows[] = array('Delivery', $delivery);
     $tableRows[] = array('Single Address', $singleAddress);
     $this->io->table($tableHeaders, $tableRows);
 }
コード例 #11
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Pre-commit delete');
     $git = new GitVersionControl();
     $projectBase = $git->getProjectBase();
     $hookDir = $projectBase . '/.git/hooks';
     if (!$io->confirm('Are you sure to remove Pre-commit hooks on this project?', true)) {
         exit(0);
     }
     $output->writeln('');
     if (!is_dir($hookDir)) {
         $io->error(sprintf('The git hook directory does not exist (%s)', $hookDir));
         exit(1);
     }
     $target = $hookDir . '/pre-commit';
     $fs = new Filesystem();
     if (is_file($target)) {
         $fs->remove($target);
         $io->success('pre-commit was deleted');
         exit(0);
     }
     $io->error(sprintf('pre-commit file does\'nt exist (%s)', $target));
     exit(1);
 }
コード例 #12
0
 /**
  * Execute the command.
  *
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @throws Exception
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->input = $input;
     $this->output = $output;
     $this->formatter = new SymfonyStyle($input, $output);
     if (!$this->multiLanguageIsEnabled) {
         $this->formatter->error(['site.multilanguage should be set to true in parameters.yml.', 'Warning: All your urls will change from example.com/page to example.com/[locale]/page']);
         return;
     }
     $this->installedLocale = array_flip($this->settings->get('Core', 'languages'));
     $this->interfaceLocale = array_flip($this->settings->get('Core', 'interface_languages'));
     $this->enabledLocale = array_flip($this->settings->get('Core', 'active_languages'));
     $this->redirectLocale = array_flip($this->settings->get('Core', 'redirect_languages'));
     $this->defaultEnabledLocale = $this->settings->get('Core', 'default_language');
     $this->defaultInterfaceLocale = $this->settings->get('Core', 'default_interface_language');
     $this->output->writeln($this->formatter->title('Fork CMS locale enable'));
     $this->showLocaleOverview();
     $this->selectWorkingLocale();
     if (!$this->askToInstall()) {
         return;
     }
     $this->askToAddInterfaceLocale();
     if ($this->askToMakeTheLocaleAccessibleToVisitors()) {
         $this->askToEnableTheLocaleForRedirecting();
     }
 }
コード例 #13
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Check Pre-commit requirements');
     $hasError = false;
     $resultOkVal = '<fg=green>✔</>';
     $resultNokVal = '<fg=red>✘</>';
     $commands = ['Composer' => array('command' => 'composer', 'result' => $resultOkVal), 'xmllint' => array('command' => 'xmllint', 'result' => $resultOkVal), 'jsonlint' => array('command' => 'jsonlint', 'result' => $resultOkVal), 'eslint' => array('command' => 'eslint', 'result' => $resultOkVal), 'sass-convert' => array('command' => 'sass-convert', 'result' => $resultOkVal), 'scss-lint' => array('command' => 'scss-lint', 'result' => $resultOkVal), 'phpcpd' => array('command' => 'phpcpd', 'result' => $resultOkVal), 'php-cs-fixer' => array('command' => 'php-cs-fixer', 'result' => $resultOkVal), 'phpmd' => array('command' => 'phpmd', 'result' => $resultOkVal), 'phpcs' => array('command' => 'phpcs', 'result' => $resultOkVal), 'box' => array('command' => 'box', 'result' => $resultOkVal)];
     foreach ($commands as $label => $command) {
         if (!$this->checkCommand($label, $command['command'])) {
             $commands[$label]['result'] = $resultNokVal;
             $hasError = true;
         }
     }
     // Check Php conf param phar.readonly
     if (!ini_get('phar.readonly')) {
         $commands['phar.readonly'] = array('result' => $resultOkVal);
     } else {
         $commands['phar.readonly'] = array('result' => 'not OK (set "phar.readonly = Off" on your php.ini)');
     }
     $headers = ['Command', 'check'];
     $rows = [];
     foreach ($commands as $label => $cmd) {
         $rows[] = [$label, $cmd['result']];
     }
     $io->table($headers, $rows);
     if (!$hasError) {
         $io->success('All Requirements are OK');
     } else {
         $io->note('Please fix all requirements');
     }
     exit(0);
 }
コード例 #14
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->migrationPath = str_replace('/', DIRECTORY_SEPARATOR, $this->getContainer()->getParameter('campaignchain_update.bundle.schema_dir'));
     $io = new SymfonyStyle($input, $output);
     $io->title('Gathering migration files from CampaignChain packages');
     $io->newLine();
     $locator = $this->getContainer()->get('campaignchain.core.module.locator');
     $bundleList = $locator->getAvailableBundles();
     if (empty($bundleList)) {
         $io->error('No CampaignChain Module found');
         return;
     }
     $migrationsDir = $this->getContainer()->getParameter('doctrine_migrations.dir_name');
     $fs = new Filesystem();
     $table = [];
     foreach ($bundleList as $bundle) {
         $packageSchemaDir = $this->getContainer()->getParameter('kernel.root_dir') . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . $bundle->getName() . $this->migrationPath;
         if (!$fs->exists($packageSchemaDir)) {
             continue;
         }
         $migrationFiles = new Finder();
         $migrationFiles->files()->in($packageSchemaDir)->name('Version*.php');
         $files = [];
         /** @var SplFileInfo $migrationFile */
         foreach ($migrationFiles as $migrationFile) {
             $fs->copy($migrationFile->getPathname(), $migrationsDir . DIRECTORY_SEPARATOR . $migrationFile->getFilename(), true);
             $files[] = $migrationFile->getFilename();
         }
         $table[] = [$bundle->getName(), implode(', ', $files)];
     }
     $io->table(['Module', 'Versions'], $table);
     if (!$input->getOption('gather-only')) {
         $this->getApplication()->run(new ArrayInput(['command' => 'doctrine:migrations:migrate', '--no-interaction' => true]), $output);
     }
 }
コード例 #15
0
 /**
  * @param InputInterface  $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Import sentry events');
     $organisation = $input->getArgument('organisation');
     $project = $input->getArgument('project');
     $projectBlacklist = $input->getOption('project-blacklist');
     $sentryRequest = new SentryRequest($input->getOption('sentry-url'), $input->getOption('sentry-api-key'));
     $projects = [$project];
     if (null === $project) {
         $projects = $this->application['project.collector']->getSlugs($sentryRequest, $organisation);
     }
     $progress = new ProgressBar($output);
     $progress->start();
     foreach ($projects as $project) {
         if (in_array($project, $projectBlacklist)) {
             continue;
         }
         $simplifiedEvents = $this->application['event.collector']->getSimplifiedEvents($sentryRequest, $organisation, $project);
         foreach ($simplifiedEvents as $simplifiedEvent) {
             $this->application['importer']->import($organisation, $project, $simplifiedEvent);
             $progress->advance();
         }
     }
     $progress->finish();
     $io->newLine(2);
     $eventCount = $this->application['db']->fetchColumn('SELECT COUNT(*) FROM events');
     $io->success(sprintf('%s events are available.', $eventCount));
 }
コード例 #16
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     mb_internal_encoding('UTF-8');
     try {
         list($line, $colonne) = explode("x", $input->getOption("size"));
         $symfonyStyle = new SymfonyStyle($input, $output);
         $symfonyStyle->title("IA");
         $mapRender = !$input->getOption("curse") ? new ConsoleMapRender($output, true) : new NCurseRender($line, $colonne);
         if (!$input->getOption("load-dump")) {
             $sizeMap = $mapRender->getSize();
             $mapProvider = $input->getOption("map") ? new FileMapProvider($input->getOption("map")) : new RandomMapProvider($sizeMap["y"], $sizeMap["x"]);
             $map = new MapBuilder($mapProvider->getMap());
             $world = new World($map, array($this->addChat(5, 5), $this->addChat(10, 10)));
         } else {
             $file = $input->getOption("load-dump");
             if (!file_exists($file)) {
                 if (extension_loaded("ncurses") && $mapRender instanceof NCurseRender) {
                     ncurses_end();
                 }
                 $symfonyStyle->error("le fichier {$file} n'existe pas");
                 return;
             }
             $world = unserialize(file_get_contents($file))->getFlashMemory()->all()[0]->getData();
         }
         while (1) {
             $this->render($mapRender, $world);
         }
     } catch (\Exception $e) {
         if (extension_loaded("ncurses") && $mapRender instanceof NCurseRender) {
             ncurses_end();
         }
         $symfonyStyle->error($e->getMessage());
         return;
     }
 }
コード例 #17
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $outputStyle = new SymfonyStyle($input, $output);
     $outputStyle->title('Displaying current configuration for currency exchange bundle');
     $this->displaySources($outputStyle)->displayNewLine($outputStyle)->displayProcessors($outputStyle)->displayNewLine($outputStyle)->displayRepository($outputStyle)->displayNewLine($outputStyle)->displayRates($outputStyle)->displayNewLine($outputStyle);
     $outputStyle->success('Configuration is valid.');
 }
コード例 #18
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title('Exporting databases');
     $io->section('Exporting all databases');
     $strategies = $this->collectorDbStrategy->collectDatabasesStrategies();
     $totalStrategies = count($strategies);
     $io->writeln($totalStrategies . ' strategie(s) found.');
     $progressBar = new ProgressBar($output, $totalStrategies);
     $progressBar->setFormat(self::PROGRESS_BAR_FORMAT);
     $progressBar->setMessage('Beginning backuping');
     $this->eventDispatcher->dispatch(Events::BACKUP_BEGINS, new BackupBeginsEvent($output));
     $progressBar->start();
     $reportContent = new \ArrayObject();
     foreach ($strategies as $strategy) {
         $strategyIdentifier = $strategy->getIdentifier();
         $setProgressBarMessage = function ($message) use($progressBar, $strategyIdentifier) {
             $message = "[{$strategyIdentifier}] {$message}";
             $progressBar->setMessage($message);
             $progressBar->display();
         };
         $exportedFiles = $this->processorDatabaseDumper->dump($strategy, $setProgressBarMessage);
         $reportContent->append("Backuping of the database: {$strategyIdentifier}");
         foreach ($exportedFiles as $file) {
             $filename = $file->getPath();
             $reportContent->append("\t→ {$filename}");
         }
         $progressBar->advance();
     }
     $progressBar->finish();
     $io->newLine(2);
     $io->section('Report');
     $io->text($reportContent->getArrayCopy());
     $this->eventDispatcher->dispatch(Events::BACKUP_ENDS, new BackupEndsEvent($output));
 }
コード例 #19
0
ファイル: StatsNormalizeCommand.php プロジェクト: ojs/ojs
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->text('Issue Total View Normalize Started');
     $this->normalizeIssueTotalArticleView();
     $this->io->text('Issue Total Download Normalize Started');
     $this->normalizeIssueTotalArticleDownload();
     $this->io->newLine();
     $this->io->text('Journal Normalize Started');
     $this->normalizeJournalTotalArticleView();
     $this->io->text('Journal Total View Normalize Finished');
     $this->normalizeJournalTotalArticleDownload();
     $this->io->text('Journal Total Download Normalize Finished');
     $this->io->newLine(2);
     $this->io->success('All process finished');
 }
コード例 #20
0
 /**
  * @param SymfonyStyle|null $io
  */
 public function updateCode(SymfonyStyle $io = null)
 {
     $io->title('CampaignChain Data Update');
     if (empty($this->versions)) {
         $io->warning('No code updater Service found, maybe you didn\'t enable a bundle?');
         return;
     }
     $io->comment('The following data versions will be updated');
     $migratedVersions = array_map(function (DataUpdateVersion $version) {
         return $version->getVersion();
     }, $this->em->getRepository('CampaignChainUpdateBundle:DataUpdateVersion')->findAll());
     $updated = false;
     foreach ($this->versions as $version => $class) {
         if (in_array($version, $migratedVersions)) {
             continue;
         }
         $io->section('Version ' . $class->getVersion());
         $io->listing($class->getDescription());
         $io->text('Begin data update');
         $result = $class->execute($io);
         if ($result) {
             $dbVersion = new DataUpdateVersion();
             $dbVersion->setVersion($version);
             $this->em->persist($dbVersion);
             $this->em->flush();
             $io->text('Data update finished');
         }
         $updated = true;
     }
     if (!$updated) {
         $io->success('All data is up to date.');
     } else {
         $io->success('Every data version has been updated.');
     }
 }
コード例 #21
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->getJournals()));
     $counter = 1;
     foreach ($this->getJournals() as $journal) {
         $this->addTranslation($journal);
         $this->io->progressAdvance(1);
         $counter = $counter + 1;
         if ($counter % 50 == 0) {
             $this->em->flush();
         }
     }
     $this->em->flush();
     $this->io->success('All process finished');
 }
コード例 #22
0
    /**
     * {@inheritdoc}
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $io = new SymfonyStyle($input, $output);
        $commandTitle = '                     Majora Installer                    ';
        $commandHelper = <<<COMMAND_HELPER
    <info>This is installer for majora-standard-edition</info>
   
    Create project to <info>current directory</info>: 
    
        <comment>majora new <Project Name></comment>
        
    Create project <info>for path</info>: 
    
        <comment>majora new <Path></comment>
        
    Create project <info>based on a specific branch</info>: 
    
        <comment>majora new <Project Name> <BranchName> </comment>
        
        
        
COMMAND_HELPER;
        $io->title($commandTitle);
        $io->writeln($commandHelper);
    }
コード例 #23
0
 public function interact(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $bundle = $input->getArgument('bundle');
     $name = $input->getArgument('name');
     $container = $this->getContainer();
     if (null !== $bundle && null !== $name) {
         return;
     }
     $io->title('Generate new RPC method');
     // Bundle name
     $bundle = $io->ask('Bundle name', null, function ($answer) use($container) {
         try {
             $container->get('kernel')->getBundle($answer);
         } catch (\Exception $e) {
             throw new \RuntimeException(sprintf('Bundle "%s" does not exist.', $answer));
         }
         return $answer;
     });
     $input->setArgument('bundle', $bundle);
     // Method name
     $name = $io->ask('Method name', null, function ($answer) use($container, $bundle) {
         if (empty($answer)) {
             throw new \RuntimeException('Method name can`t be empty.');
         }
         $answer = str_replace(' ', ':', $answer);
         if ($this->isMethodExist($container->get('kernel')->getBundle($bundle), $answer)) {
             throw new \RuntimeException(sprintf('Method "%s" already exist.', $answer));
         }
         return $answer;
     });
     $input->setArgument('name', $name);
 }
コード例 #24
0
 public function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $pastDate = $input->getOption(self::PAST_DATE) ? new DateTime($input->getOption(self::PAST_DATE)) : null;
     $data = $this->vendorProcessor->getWallets($this->merchantGroupId, $pastDate);
     $io->title("Hipay Wallets");
     $io->table(array_keys(reset($data)), $data);
 }
コード例 #25
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title('Synchronize all mail events.');
     $mailEventClassChain = $this->container->get('ojs_core.mail.event_chain')->getMailEvents();
     foreach ($mailEventClassChain as $mailEventClass) {
         if ($mailEventClass instanceof MailEventsInterface) {
             $getEvensOptions = $mailEventClass->getMailEventsOptions();
             foreach ($getEvensOptions as $eventOption) {
                 if ($eventOption instanceof EventDetail) {
                     $this->startMailEventSync($eventOption);
                 } else {
                     throw new \LogicException('all array item must be instance of EventDetail Class');
                 }
             }
         }
     }
 }
コード例 #26
0
 /**
  * @param InputInterface $input
  * @param OutputInterface $output
  *
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->io->title($this->getDescription());
     $this->io->progressStart(count($this->getAnnouncements()));
     $counter = 1;
     foreach ($this->getAnnouncements() as $announcement) {
         if (!$this->haveTranslation($announcement['id'])) {
             $this->addTranslation($announcement);
             $this->io->progressAdvance(1);
             $counter = $counter + 1;
             if ($counter % 50 == 0) {
                 $this->em->flush();
             }
         }
     }
     $this->em->flush();
     $this->io->success('All process finished');
 }
コード例 #27
0
 /**
  * Executes the command for adding or removing the lock file
  * @param InputInterface $input
  * @param OutputInterface $output
  * @return void
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $io = new SymfonyStyle($input, $output);
     $io->title($this->getDescription());
     if ($this->getName() === 'backend:unlock') {
         $this->unlock($io);
     } else {
         $this->lock($io, $input);
     }
 }
コード例 #28
0
 /**
  * If the user does not specify the $name parameter, then we will
  * prompt for it here.
  *
  * @hook interact
  *
  * @param \Symfony\Component\Console\Input\InputInterface $input
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  */
 public function interact(InputInterface $input, OutputInterface $output)
 {
     $available_art = $this->availableArt();
     $io = new SymfonyStyle($input, $output);
     $art_name = $input->getArgument('name');
     if (!$art_name) {
         $io->title('Available Art');
         $io->listing($available_art);
     }
 }
コード例 #29
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $this->updateDb = $input->getOption('update-db');
     $io = new SymfonyStyle($input, $output);
     $io->title("Running deploy tasks...");
     $this->clearMetadata($io);
     $this->clearCache($io, 'prod');
     $this->checkDatabase($io);
     $this->installAssets($io);
 }
コード例 #30
-1
ファイル: GuessAuthorUserCommand.php プロジェクト: ojs/ojs
    /**
     * @param InputInterface $input
     * @param OutputInterface $output
     *
     * @return void
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->io->title($this->getDescription());
        $totalAuthorCount = $this->getAuthorCount();
        $this->io->progressStart($totalAuthorCount);
        $rsm = new ResultSetMapping();
        for ($count = 0; $count <= $totalAuthorCount; $count += self::STEP) {
            $sql = <<<SQL
        UPDATE author
        SET user_id = users.id
        FROM users
        WHERE author.email = users.email
        AND author.id > ?
        and author.id < ?
        and author.user_id is null
SQL;
            $query = $this->em->createNativeQuery($sql, $rsm);
            $query->setParameter(1, $count);
            $query->setParameter(2, $count + self::STEP);
            $query->getResult();
            if (self::STEP > $totalAuthorCount) {
                $this->io->progressFinish();
            } else {
                $this->io->progressAdvance(self::STEP);
            }
        }
        $this->io->newLine(2);
        $this->io->success('All process finished');
    }