Various cleanup in import.

This commit is contained in:
James Cole
2018-01-10 18:18:49 +01:00
parent 87dae6ea18
commit 91178d2604
10 changed files with 272 additions and 153 deletions

View File

@@ -98,7 +98,7 @@ class CsvProcessor implements FileProcessorInterface
if ($this->rowAlreadyImported($row)) {
$message = sprintf('Row #%d has already been imported.', $index);
$this->repository->addStepsDone($this->job, 5);
$this->addError($index, $message);
$this->repository->addError($this->job, $index, $message);
Log::info($message);
return null;
@@ -154,23 +154,6 @@ class CsvProcessor implements FileProcessorInterface
return $this;
}
/**
* Shorthand method.
*
* @codeCoverageIgnore
*
* @param int $index
* @param string $message
*/
private function addError(int $index, string $message): void
{
$extended = $this->getExtendedStatus();
$extended['errors'][$index][] = $message;
$this->setExtendedStatus($extended);
return;
}
/**
* Add meta data to the individual value and verify that it can be handled in a later stage.
*
@@ -375,7 +358,7 @@ class CsvProcessor implements FileProcessorInterface
*/
private function specifics(array $row): array
{
$config = $this->job->configuration;
$config = $this->getConfig();
$names = array_keys($config['specifics'] ?? []);
foreach ($names as $name) {
if (!in_array($name, $this->validSpecifics)) {