/** * @throws \RuntimeException */ protected function retry() { $retriesLeft = $this->part->getRetries(); if ($retriesLeft < 1) { throw new \RuntimeException('No more retries left!'); } $this->part->setRetries(--$retriesLeft); $this->part->setDatetimeEnded(null); $this->part->setProcess(null); $this->repository->savePart($this->part); }
/** * @param ImportPart $part */ public function finishImportPart(ImportPart $part) { if (!$part->isStarted()) { throw new \RuntimeException('Import part has not yet started'); } $part->setDatetimeEnded(new \DateTime()); $this->savePart($part); }