mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-24 05:04:07 -08:00
Use getReader instead of fetchAssoc for CSV parser
https://csv.thephpleague.com/9.0/upgrading/
This commit is contained in:
parent
d1a8955ef9
commit
bf93e8cc32
|
@ -49,7 +49,7 @@ class ImportLocations extends Command
|
||||||
$csv = Reader::createFromPath(storage_path('private_uploads/imports/').$filename, 'r');
|
$csv = Reader::createFromPath(storage_path('private_uploads/imports/').$filename, 'r');
|
||||||
$this->info('Attempting to process: '.storage_path('private_uploads/imports/').$filename);
|
$this->info('Attempting to process: '.storage_path('private_uploads/imports/').$filename);
|
||||||
$csv->setOffset(1); //because we don't want to insert the header
|
$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
|
// Import parent location names first if they don't exist
|
||||||
foreach ($results as $parent_index => $parent_row) {
|
foreach ($results as $parent_index => $parent_row) {
|
||||||
|
|
|
@ -579,7 +579,7 @@ class AssetsController extends Controller
|
||||||
//get the first row, usually the CSV header
|
//get the first row, usually the CSV header
|
||||||
//$headers = $csv->fetchOne();
|
//$headers = $csv->fetchOne();
|
||||||
|
|
||||||
$results = $csv->fetchAssoc();
|
$results = $csv->getRecords();
|
||||||
$item = array();
|
$item = array();
|
||||||
$status = array();
|
$status = array();
|
||||||
$status['error'] = array();
|
$status['error'] = array();
|
||||||
|
|
|
@ -120,7 +120,7 @@ abstract class Importer
|
||||||
public function import()
|
public function import()
|
||||||
{
|
{
|
||||||
$headerRow = $this->csv->fetchOne();
|
$headerRow = $this->csv->fetchOne();
|
||||||
$results = $this->normalizeInputArray($this->csv->fetchAssoc());
|
$results = $this->normalizeInputArray($this->csv->getRecords());
|
||||||
|
|
||||||
$this->populateCustomFields($headerRow);
|
$this->populateCustomFields($headerRow);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue