/** * @param ImportPart $part * @param Feed $feed * @param ProcessorInterface $processor * @param Importer $importer * @param ImportRepository $repository * * @throws \RuntimeException When the import or the part has already finished */ public function __construct(ImportPart $part, Feed $feed, ProcessorInterface $processor, Importer $importer, ImportRepository $repository) { $this->feed = $feed; $this->part = $part; $this->processor = $processor; $this->importer = $importer; $this->repository = $repository; $this->logger = new NullLogger(); $import = $part->getImport(); // check if import has already finished if ($import->isFinished()) { throw new \RuntimeException(sprintf('Import %d has already finished', $import->getId())); } // check if this part has already finished if ($part->isFinished()) { throw new \RuntimeException(sprintf('Part %d of import %d has already finished', $part->getPosition(), $import->getId())); } }