From bf93e8cc32bdf51d71c3e6cf34d98d78141f8311 Mon Sep 17 00:00:00 2001 From: snipe Date: Thu, 23 May 2019 19:09:58 -0700 Subject: [PATCH] Use getReader instead of fetchAssoc for CSV parser https://csv.thephpleague.com/9.0/upgrading/ --- app/Console/Commands/ImportLocations.php | 2 +- app/Http/Controllers/AssetsController.php | 2 +- app/Importer/Importer.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Console/Commands/ImportLocations.php b/app/Console/Commands/ImportLocations.php index 8f566dc4ce..8dce00fd6c 100644 --- a/app/Console/Commands/ImportLocations.php +++ b/app/Console/Commands/ImportLocations.php @@ -49,7 +49,7 @@ class ImportLocations extends Command $csv = Reader::createFromPath(storage_path('private_uploads/imports/').$filename, 'r'); $this->info('Attempting to process: '.storage_path('private_uploads/imports/').$filename); $csv->setOffset(1); //because we don't want to insert the header - $results = $csv->fetchAssoc(); + $results = $csv->getRecords(); // Import parent location names first if they don't exist foreach ($results as $parent_index => $parent_row) { diff --git a/app/Http/Controllers/AssetsController.php b/app/Http/Controllers/AssetsController.php index 924d16655f..f42634ed95 100755 --- a/app/Http/Controllers/AssetsController.php +++ b/app/Http/Controllers/AssetsController.php @@ -579,7 +579,7 @@ class AssetsController extends Controller //get the first row, usually the CSV header //$headers = $csv->fetchOne(); - $results = $csv->fetchAssoc(); + $results = $csv->getRecords(); $item = array(); $status = array(); $status['error'] = array(); diff --git a/app/Importer/Importer.php b/app/Importer/Importer.php index b5aafd4bce..4d4998507a 100644 --- a/app/Importer/Importer.php +++ b/app/Importer/Importer.php @@ -120,7 +120,7 @@ abstract class Importer public function import() { $headerRow = $this->csv->fetchOne(); - $results = $this->normalizeInputArray($this->csv->fetchAssoc()); + $results = $this->normalizeInputArray($this->csv->getRecords()); $this->populateCustomFields($headerRow);