예제 #1
0
 /**
  * Dispatches an event indicating a failed item.
  *
  * @param FeedItemBag $item
  * @param string      $reason
  */
 protected function failItem(FeedItemBag $item, $reason)
 {
     $this->result->incrementFailed();
     $event = new FailedItemEvent($this, $item, $reason);
     $this->eventDispatcher->dispatch(ImportEvents::ITEM_FAILED, $event);
 }
예제 #2
0
 /**
  * @param Import       $import
  * @param ImportResult $result
  */
 public function addResult(Import $import, ImportResult $result)
 {
     $query = $this->createQueryBuilder('i')->update()->set('i.success', 'i.success + :success')->set('i.failed', 'i.failed + :failed')->set('i.skipped', 'i.skipped + :skipped')->where('i.id = :id')->getQuery();
     $query->execute(['id' => $import->getId(), 'success' => $result->getSuccess(), 'failed' => $result->getFailed(), 'skipped' => $result->getSkipped()]);
     $this->getEntityManager()->refresh($import);
 }