This commit is contained in:
James Cole
2017-09-08 20:24:11 +02:00
parent aae26c5da9
commit 2dff8aec69
2 changed files with 26 additions and 11 deletions

View File

@@ -151,10 +151,14 @@ class CsvProcessor implements FileProcessorInterface
*/
private function getImportArray(): Iterator
{
$content = $this->job->uploadFileContents();
$config = $this->job->configuration;
$reader = Reader::createFromString($content);
$reader->setDelimiter($config['delimiter']);
$content = $this->job->uploadFileContents();
$config = $this->job->configuration;
$reader = Reader::createFromString($content);
$delimiter = $config['delimiter'];
if ($delimiter === 'tab') {
$delimiter = "\t";
}
$reader->setDelimiter($delimiter);
$start = $config['has-headers'] ? 1 : 0;
$results = $reader->setOffset($start)->fetch();
Log::debug(sprintf('Created a CSV reader starting at offset %d', $start));