This issue has been addressed too early in the process lifecycle. The line number should be incremented later, say in the view layer when the error is displayed. A simple helper to determine what the index increment should do well.

$row + $indexIncrement

This is so we don't have to rebuild the array, which is computationally expensive for large datasets and could be frustrating for a developer expecting untouched index values, or likewise needing to prepare our special format.
This commit is contained in:
Samuel Georges 2017-09-17 10:14:14 +10:00
parent 510071550a
commit d30dd19b70
1 changed files with 0 additions and 10 deletions

View File

@ -146,16 +146,6 @@ abstract class ImportModel extends Model
foreach ($contents as $row) {
$result[] = $this->processImportRow($row, $matches);
}
// Offset the array index in order to have the correct row index in error logs
if ($options['firstRowTitles']) {
array_unshift($result, [], []);
unset($result[0]);
unset($result[1]);
} else {
array_unshift($result, []);
unset($result[0]);
}
return $result;
}