]> git.openstreetmap.org Git - nominatim.git/blobdiff - lib-php/AddressDetails.php
Merge pull request #3463 from lonvia/sqlalchemy14-with-psycopg
[nominatim.git] / lib-php / AddressDetails.php
index 35786d22691699c7191d05a34ecd38930312b7d0..cfdd04167c259de142147e00846ff1b9546fd8e7 100644 (file)
@@ -94,7 +94,7 @@ class AddressDetails
                 $aAddress[$sTypeLabel] = $sName;
 
                 if (!empty($aLine['name'])) {
-                    $this->addSubdivisionCode($aAddress, $sTypeLabel, $aLine['name']);
+                    $this->addSubdivisionCode($aAddress, $aLine['admin_level'], $aLine['name']);
                 }
             }
         }
@@ -179,13 +179,13 @@ class AddressDetails
         return $this->aAddressLines;
     }
 
-    private function addSubdivisionCode(&$aAddress, $sTypeLabel, $nameDetails)
+    private function addSubdivisionCode(&$aAddress, $iAdminLevel, $nameDetails)
     {
         if (is_string($nameDetails)) {
             $nameDetails = json_decode('{' . str_replace('"=>"', '":"', $nameDetails) . '}', true);
         }
         if (!empty($nameDetails['ISO3166-2'])) {
-            $aAddress["$sTypeLabel-ISO3166-2"] = $nameDetails['ISO3166-2'];
+            $aAddress["ISO3166-2-lvl$iAdminLevel"] = $nameDetails['ISO3166-2'];
         }
     }
 }