/**
  * @param \Spryker\Shared\Library\BatchIterator\CountableIteratorInterface $batchCollection
  * @param \Spryker\Zed\Collector\Business\Model\BatchResultInterface $batchResult
  * @param \Symfony\Component\Console\Output\OutputInterface $output
  *
  * @return \Symfony\Component\Console\Helper\ProgressBar
  */
 protected function startProgressBar(CountableIteratorInterface $batchCollection, BatchResultInterface $batchResult, OutputInterface $output)
 {
     $this->displayProgressWhileCountingBatchCollectionSize($output);
     $totalCount = $batchCollection->count();
     $batchResult->setTotalCount($totalCount);
     $progressBar = $this->generateProgressBar($output, $totalCount);
     $progressBar->start();
     $progressBar->advance(0);
     return $progressBar;
 }
Ejemplo n.º 2
0
 /**
  * @param \Spryker\Zed\Collector\Business\Model\BatchResultInterface $result
  *
  * @throws \Spryker\Zed\Collector\Business\Exporter\Exception\BatchResultException
  *
  * @return void
  */
 protected function handleResult(BatchResultInterface $result)
 {
     if ($result->isFailed()) {
         throw new BatchResultException(sprintf('Processed %d from %d for locale %s, where %d were deleted and %d failed.', $result->getProcessedCount(), $result->getTotalCount(), $result->getProcessedLocale(), $result->getDeletedCount(), $result->getFailedCount()));
     }
 }
Ejemplo n.º 3
0
 /**
  * @param \Spryker\Zed\Collector\Business\Model\BatchResultInterface $result
  *
  * @return void
  */
 protected function resetResult(BatchResultInterface $result)
 {
     $result->setProcessedCount(0);
     $result->setIsFailed(false);
     $result->setTotalCount(0);
     $result->setDeletedCount(0);
 }