import addresses and postal codes from bestaddress

This commit is contained in:
2022-09-03 00:40:21 +02:00
parent 84cda8845d
commit 0f63548d5a
6 changed files with 280 additions and 4 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Service\Import;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Statement;
use Exception;
use function array_key_exists;
use function count;
@@ -40,7 +41,7 @@ class PostalCodeBaseImporter
0,
g.refpostalcodeid,
g.postalcodeSource,
CASE WHEN (g.lon::float != 0.0 AND g.lat::float != 0.0) THEN ST_setSrid(ST_point(g.lon::float, g.lat::float), g.srid::int) ELSE NULL END,
CASE WHEN (g.lon::float != 0.0 AND g.lat::float != 0.0) THEN ST_Transform(ST_setSrid(ST_point(g.lon::float, g.lat::float), g.srid::int), 4326) ELSE NULL END,
NOW(),
NOW()
FROM g
@@ -112,7 +113,7 @@ class PostalCodeBaseImporter
try {
$statement->executeStatement(array_merge(...$this->waitingForInsert));
} catch (\Exception $e) {
} catch (Exception $e) {
// in some case, we can add debug code here
//dump($this->waitingForInsert);
throw $e;