Dispatch domain event.

@param InputInterface  $input
@param OutputInterface $output

@return mixed|null
423220
protected function runCommand(InputInterface $input, OutputInterface $output)
    {
        $appName = $input->getArgument('app-name');
        list($_, $indexUUID) = $this->getRepositoryAndIndex($input, $output);

        try {
            $this
                ->repositoryBucket
                ->findRepository($appName)
                ->deleteIndex($indexUUID);
        } catch (ResourceNotAvailableException $exception) {
            self::printInfoMessage(
                $output,
                $this->getHeader(),
                'Index not found. Skipping.'
            );
        }
    }
1161332
protected function execute(InputInterface $input, OutputInterface $output)
    {
        if (null === $this->em) {
            $this->em = $this->getContainer()->get('doctrine.orm.entity_manager');
        }

        $configRepository = $this->em->getRepository('KunstmaanDashboardBundle:AnalyticsConfig');

        $configId = $input->getArgument('config') ? $input->getArgument('config') : false;

        try {
            $configRepository->flushConfig($configId);
            $output->writeln('<fg=green>Data flushed</fg=green>');
        } catch (\Exception $e) {
            $output->writeln('<fg=red>'.$e->getMessage().'</fg=red>');
        }
    }
1109049
public function getIO(InputInterface $input, OutputInterface $output) : IO
    {
        if (null === $this->io) {
            $this->io = new IO\DefaultIO($input, $output, $this->getHelperSet());
        }
        return $this->io;
    }
869200
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $context = json_decode($input->getOption('context') ?: '{}', true);
        $context['tenant_id'] = (string)$input->getOption('tenant-id');

        $io = new SymfonyStyle($input, $output);
        $io->title('EventStore Storage Describer');
        $io->comment(sprintf('context: %s', json_encode($context)));

        $details = $this->getPbjx()->getEventStore()->describeStorage($context);
        $io->text($details);
        $io->newLine();
    }
755651
public function doRun(InputInterface $input, OutputInterface $output)
    {
        if (!$this->commandsRegistered) {
            $this->registerCommands();

            $this->commandsRegistered = true;
        }

        return parent::doRun($input, $output);
    }
113850
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $queueType = $input->getOption('queue-type');
        $notifyEmail = $input->getOption('notify-email');

        $manager = $this->getManager();

        if ($notifyEmail !== false) {
            $notify = new \Expose\Notify\Email();
            $notify->setToAddress($notifyEmail);
            $manager->setNotify($notify);
        }

        if ($queueType !== false) {
            $queueConnect = $input->getOption('queue-connect');
            if ($queueConnect === false) {
                $output->writeln('<error>Queue connection string not provided</error>');
                return;
            }
            // make the queue object with the right adapter
            $queueClass = '\\Expose\\Queue\\'.ucwords(strtolower($queueType));
            if (!class_exists($queueClass)) {
                $output->writeln('<error>Invalid queue type "'.$queueType.'"</error>');
                return;
            }
            $queue = new $queueClass();

            $adapter = $this->buildAdapter($queueType, $queueConnect, $queue->getDatabase());
            if ($adapter === false) {
                $output->writeln('<error>Invalid connection string</error>');
                return;
            }
            $queue->setAdapter($adapter);

        } else {
            $output->writeln('<error>Queue type not defined</error>');
            return;
        }
        $this->setQueue($queue);

        if ($input->getOption('list') !== false) {
            $output->writeln('<info>Current Queue Items Pending</info>');
            $this->listQueue($manager, $queue);
            return true;
        }

        // by default process the current queue
        $reports = $this->processQueue($output);
        if (count($reports) == 0) {
            return;
        }

        $exportFile = $input->getOption('export-file');
        if ($exportFile !== false) {
            $output->writeln('<info>Outputting results to file '.$exportFile.'</info>');
            file_put_contents(
                $exportFile,
                '['.date('m.d.Y H:i:s').'] '.json_encode($reports),
                FILE_APPEND
            );
        } else {
            echo json_encode($reports);
        }
    }
965828
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->startCommand($output);

        $configurationIdentifier = $input->getArgument('identifier');
        $configurationValue = json_encode($this
            ->configurationManager
            ->get($configurationIdentifier));

        $this->printMessage(
            $output,
            'Configuration',
            $configurationIdentifier . ' : "' . $configurationValue . '"'
        );

        $this->finishCommand($output);
    }
40616
protected function execute(InputInterface $input, OutputInterface $output)
  {
    $name = $input->getArgument('name');
    $type = $input->getArgument('type');

    if (!in_array(strtolower($type), ['model', 'group'])) {
      return $output->writeln('Unknown query map type');
    }

    if ($this->add($name, $type)) {
      return $output->writeln('<info>Query Map "' . $name . '" has been successfully created.</info>');
    }

    return $output->writeln('Query Map "' . $name . '" already exists.');
  }
778769
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $bugId = $input->getArgument('bug-id');
        $reducer = $input->getArgument('reducer');
        $length = $input->getArgument('length');
        $from = $input->getArgument('from');
        $to = $input->getArgument('to');

        $this->setAnonymousToken();

        $pathReducer = $this->pathReducerManager->getPathReducer($reducer);
        $pathReducer->handle($bugId, $length, $from, $to);
    }
175187
protected function initialize(InputInterface $input, OutputInterface $output)
    {
        $this->getApplication()->getDispatcher()->dispatch(
            GushEvents::INITIALIZE,
            new ConsoleCommandEvent($this, $input, $output)
        );
    }
479373
protected function execute(InputInterface $input, OutputInterface $output)
    {
        try {
            $queue = $this->dispatcher->getQueue();

            $queue->checkStuckJobs();
            $queue->cleanUp();

            return $this->success('Queue maintenance done', $input, $output);
        } catch (Exception $e) {
            return $this->abortDueToException($e, $input, $output);
        }
    }
496129
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $created = $this->scaffold(
            'ajax',
            [
                'CLASSNAME' => $input->getArgument('name'),
            ],
            [
                'ACTION' => $input->getOption('action'),
            ]
        );

        if ($created === true) {
            $output->writeln("<info>{$input->getArgument('name')} was created successfully</info>");
        } else {
            $output->writeln("<error>{$input->getArgument('name')} could not be created</error>");
        }
    }
68908
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $start = time();

        $em = $this->getContainer()->get('doctrine.orm.entity_manager');
        $dispatcher = $this->getContainer()->get('event_dispatcher');
        /* @var $rep StorageRepository */
        $rep = $em->getRepository('AnimeDbCatalogBundle:Storage');

        $progress = $this->getProgress($input, $output);
        $lazywrite = new LazyWrite($output);
        $lazywrite->setLazyWrite(!$input->getOption('no-progress'));

        // get list storages
        if ($id = $input->getArgument('storage')) {
            $storage = $rep->find($id);
            if (!($storage instanceof Storage)) {
                throw new \InvalidArgumentException('Not found the storage with id: '.$id);
            }
            if (!$storage->isWritable()) {
                throw new \InvalidArgumentException('Storage "'.$storage->getName().'" can not be scanned');
            }
            $storages = [$storage];
        } else {
            $storages = $rep->getList(Storage::getTypesWritable());
        }

        /* @var $storage Storage */
        foreach ($storages as $storage) {
            $output->writeln('Scan storage <info>'.$storage->getName().'</info>:');

            $path = $storage->getPath();
            $path = Utf8::wrapPath($path); // wrap path for current fs

            if (!file_exists($path)) {
                $output->writeln('Storage is not available');
                continue;
            }

            // check storage id
            $owner = $this->checkStorageId($path, $storage, $rep);
            if ($owner instanceof Storage) {
                $output->writeln('Path <info>'.$storage->getPath().'</info> reserved storage <info>'
                    .$owner->getName().'</info>');
                continue;
            }

            // storage not modified
            if (!$input->getOption('force') &&
                $storage->getFileModified() &&
                filemtime($path) == $storage->getFileModified()->getTimestamp()
            ) {
                $output->writeln('Storage is not modified');
                continue;
            }

            $files = $this->getFilesByPath($path);
            $total = $files->count();
            // total files +1% for check of delete files
            $progress->start(ceil($total + ($total * 0.01)));
            $progress->display();

            /* @var $file SplFileInfo */
            foreach ($files as $file) {
                // ignore not supported files
                if ($file->isFile() && !$this->isAllowFile($file)) {
                    $progress->advance();
                    continue;
                }

                // item is exists and modified
                if ($item = $this->getItemFromFile($storage, $file)) {
                    if ($item->getDateUpdate()->getTimestamp() < $file->getPathInfo()->getMTime()) {
                        $dispatcher->dispatch(StoreEvents::UPDATE_ITEM_FILES, new UpdateItemFiles($item));
                        $lazywrite->writeln('Changes are detected in files of item <info>'.$item->getName().'</info>');
                    }
                } else {
                    // remove wrap prefix
                    list(, $file) = explode('://', $file->getPathname(), 2);
                    $file = new SplFileInfo($file, '', '');

                    // it is a new item
                    $name = $this->getContainer()->get('anime_db.storage.filename_cleaner')->clean($file);
                    $dispatcher->dispatch(
                        StoreEvents::DETECTED_NEW_FILES,
                        new DetectedNewFiles($storage, $file, $name)
                    );
                    $lazywrite->writeln('Detected files for new item <info>'.$file->getFilename().'</info>');
                }
                $progress->advance();
            }
            $em->refresh($storage);

            // check of delete file for item
            foreach ($this->getItemsOfDeletedFiles($storage, $files) as $item) {
                $dispatcher->dispatch(StoreEvents::DELETE_ITEM_FILES, new DeleteItemFiles($item));
                $lazywrite->writeln('<error>Files for item "'.$item->getName().'" is not found</error>');
            }
            $progress->advance();
            $progress->finish();
            $lazywrite->writeAll();

            // update date modified
            $storage->setFileModified(new \DateTime(date('Y-m-d H:i:s', filemtime($path))));
            $em->persist($storage);
            $output->writeln('');
        }
        $em->flush();

        $output->writeln('Time: <info>'.(time() - $start).'</info> s.');
    }
666264
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $remote = $input->getOption('remote');

        $persistence = $this->getPersistence();

        if (null === $remote) {
            $dialog = $this->getHelper('dialog');

            $remote = $dialog->ask($output, 'Please enter a Git remote to clone and pull from and to push to: ');

            if (!$dialog->askConfirmation($output, '<question>'.$remote.' will be cloned into '.$persistence->getDirectoryName().'. Continue? [y] </question>', false)) {
                $output->writeln('Not cloning, cancelled.');

                return;
            }
        }

        $output->writeln('Cloning...');
        $persistence->cloneRepository($remote);

        $output->writeln(sprintf('Init of git repository for remote "%s" in %s successful', $remote, $persistence->getDirectoryName()));
    }
167902
protected function execute(InputInterface $input, OutputInterface $output)
    {
        parent::execute($input, $output);

        //$this->runCacheClear(false);
        //$this->runDoctrineMigrate();
        $this->runDoctrineSchemaUpdate();
        $this->runUpdateRoutes();
        $this->runCreateSnapshots();
        //$this->runDoctrineFixturesLoadAppend();
        $this->runCommand('compo:notification:load');
        $this->runCommand('compo:seo:page:load');

        //
        //$this->runCacheWarmup();

        return null;
    }
1147623
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $output->writeln('Running publisher...');

        $this->getApplication()->getPublisher()->publish($output);

        $output->writeln('Finished!');
    }
397728
protected function executeAddDomain(InputInterface $input, OutputInterface $output) {

        // Ask for a domain
        $domain_question = new Question('What domain would you like to add as a VIRTUAL_HOST for the server? (Do NOT include http://) ');
        $name = $this->getAnswer($input, $output, $domain_question, 'domain', 'argument', TRUE);

        // Add the domain to the domain property.
        $output->writeln("Adding domain: <info>{$name}</info>");

        $this->environment->domains[] = $name;

        $helper = $this->getHelper('question');
        $question = new ConfirmationQuestion("Add the domain <comment>$name</comment> to the environment <info>{$this->app->name}:{$this->environment->name}</info> [y/N]? ", FALSE);

        if (!$helper->ask($input, $output, $question)) {
            $output->writeln("<fg=red>Domain not added.</>");
            $output->writeln('');
            exit;
        }

        // Save the new version to the config.
        $this->getApplication()->getTerra()->getConfig()->add('apps', array($this->app->name, 'environments', $this->environment->name), (array) $this->environment);
        $this->getApplication()->getTerra()->getConfig()->save();
        $output->writeln("<info>Domain added!</info> Changes won't take effect until the environment is restarted.");
        $output->writeln('');
    }