protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $importer = new ArticleStatisticImporter($this->connection, $this->em, $this->logger, $output); $stopwatch = new Stopwatch(); $stopwatch->start('stats_import'); $importer->importArticleStatistics(); $event = $stopwatch->stop('stats_import'); $output->writeln('Duration: ' . StringHelper::formatMilliseconds($event->getDuration())); }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $userManager = $this->getContainer()->get('fos_user.user_manager'); $locale = $this->getContainer()->getParameter('locale'); $tokenGenrator = $this->getContainer()->get('fos_user.util.token_generator'); $userImporter = new UserImporter($this->connection, $this->em, $this->logger, $output, $userManager, $tokenGenrator, $locale); $stopwatch = new Stopwatch(); $stopwatch->start('journals_import'); $givenJournalsImporter = new GivenJournalsImporter($this->connection, $this->em, $this->logger, $output, $userImporter); $givenJournalsImporter->importJournals($input->getArgument('ids')); $event = $stopwatch->stop('journals_import'); $output->writeln('Duration: ' . StringHelper::formatMilliseconds($event->getDuration())); }
protected function execute(InputInterface $input, OutputInterface $output) { parent::execute($input, $output); $importer = new JournalContactImporter($this->connection, $this->em, $this->logger, $output); $journalsSql = 'SELECT journal_id, path FROM journals'; $journalsStatement = $this->connection->executeQuery($journalsSql); $journals = $journalsStatement->fetchAll(); $stopwatch = new Stopwatch(); $stopwatch->start('stats_import'); foreach ($journals as $journal) { $existingJournal = $this->em->getRepository('OjsJournalBundle:Journal')->findOneBy(['slug' => $journal['path']]); if ($existingJournal !== null && $existingJournal->getJournalContacts()->isEmpty()) { $importer->importContacts($existingJournal, $journal['journal_id']); $this->em->persist($existingJournal); $this->em->flush(); } } $event = $stopwatch->stop('stats_import'); $output->writeln('Duration: ' . StringHelper::formatMilliseconds($event->getDuration())); }