mirror of
				https://gitlab.com/Chill-Projet/chill-bundles.git
				synced 2025-10-31 01:08:26 +00:00 
			
		
		
		
	DX: Improve Lux address import command - WIP
This commit is contained in:
		| @@ -42,9 +42,9 @@ class AddressReferenceLU | ||||
|  | ||||
|         fclose($file); | ||||
|  | ||||
|         $uncompressedStream = gzopen($tmpname, 'r'); | ||||
|         //$uncompressedStream = gzopen($tmpname, 'r'); | ||||
|  | ||||
|         $csv = Reader::createFromStream($uncompressedStream); | ||||
|         $csv = Reader::createFromStream($file); | ||||
|         $csv->setDelimiter(';'); | ||||
|         $csv->setHeaderOffset(0); | ||||
|  | ||||
| @@ -54,7 +54,7 @@ class AddressReferenceLU | ||||
|  | ||||
|         $this->addressToReferenceMatcher->checkAddressesMatchingReferences(); | ||||
|  | ||||
|         gzclose($uncompressedStream); | ||||
|         //gzclose($uncompressedStream); | ||||
|     } | ||||
|  | ||||
|     private function process_address(Reader $csv): void | ||||
| @@ -67,7 +67,7 @@ class AddressReferenceLU | ||||
|                 $record['code_postal'], | ||||
|                 $record['rue'], | ||||
|                 $record['numero'], | ||||
|                 'bd addresses', | ||||
|                 'bd-addresses.lux', | ||||
|                 (float) $record['lat_wgs84'], | ||||
|                 (float) $record['lon_wgs84'], | ||||
|                 4326 | ||||
| @@ -82,7 +82,8 @@ class AddressReferenceLU | ||||
|         $stmt = Statement::create()->process($csv); | ||||
|         $arr_postal_codes = []; | ||||
|         foreach ($stmt as $record) { | ||||
|             if (false === \in_array($record['code_postal'], $arr_postal_codes, true)) { | ||||
|             //if (false === \in_array($record['code_postal'], $arr_postal_codes, true)) { | ||||
|             if (false === \array_key_exists($record['code_postal'], $arr_postal_codes, true)) { | ||||
|                 $this->postalCodeBaseImporter->importCode( | ||||
|                     'LU', | ||||
|                     trim((string) $record['localite']), | ||||
| @@ -93,7 +94,7 @@ class AddressReferenceLU | ||||
|                     (float) $record['lon_wgs84'], | ||||
|                     4326 | ||||
|                 ); | ||||
|                 \array_push($arr_postal_codes, $record['code_postal']); | ||||
|                 $arr_postal_codes[$record['code_postal']] = 1; | ||||
|             } | ||||
|         } | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user