コード例 #1
0
 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $minutes = (int) $input->getOption('minutes');
     if ($minutes < 1) {
         throw new \InvalidArgumentException('Minutes has to be a positive number');
     }
     if ($ids = $input->getArgument('feed')) {
         $feeds = $this->importScheduler->findByIds($ids);
     } elseif ($input->getOption('all')) {
         $feeds = $this->importScheduler->findAll();
     } else {
         $feeds = $this->importScheduler->findByTime($minutes);
     }
     if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
         $dispatcher = $this->importFactory->getEventDispatcher();
         $dispatcher->addSubscriber(new ImportOutputSubscriber($output));
     }
     $force = $input->getOption('force');
     return $this->scheduleImports($input, $output, $feeds, $minutes, $force);
 }
コード例 #2
0
 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     if ($output->getVerbosity() >= OutputInterface::VERBOSITY_NORMAL) {
         $dispatcher = $this->importFactory->getEventDispatcher();
         $dispatcher->addSubscriber(new ImportOutputSubscriber($output));
     }
     if ($importId = $input->getOption('import')) {
         $partIds = $this->getPartIds($importId);
     } elseif ($partIds = $input->getArgument('id')) {
     } else {
         throw new \RuntimeException('You must provide either a part id or an import id');
     }
     foreach ($partIds as $partId) {
         if (null === ($part = $this->findPart($partId))) {
             $output->writeln(sprintf('<error>Part with id "%d" does not exist</error>', $partId));
             continue;
         }
         $this->runImportPart($output, $part);
     }
     return 0;
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $ids = (array) $input->getArgument('id');
     if (empty($ids)) {
         $feeds = $this->getFeedRepository()->findAll();
     } else {
         $feeds = $this->getFeedRepository()->findBy(['id' => $ids]);
     }
     $dispatcher = $this->importFactory->getEventDispatcher();
     $dispatcher->addSubscriber(new ImportOutputSubscriber($output));
     $force = $input->getOption('force');
     if (empty($feeds)) {
         $output->writeln('No feeds to import');
         return 1;
     }
     foreach ($feeds as $feed) {
         if ($input->isInteractive()) {
             $this->checkForUnfinishedImports($feed, $input, $output);
         }
         $this->runImport($output, $feed, $force);
     }
     return 0;
 }