Skip to content

Commit 7fc94fd

Browse files
Copilotdr5hn
andauthored
Fix NULL handling in export workflow to prevent Antarctica subregion_id conversion from NULL to 0 (#1067)
* Initial plan * Fix Antarctica subregion_id from 0 to null in all data formats Co-authored-by: dr5hn <6929121+dr5hn@users.noreply.github.com> * Fix NULL handling in JSON export for subregion_id and region_id Co-authored-by: dr5hn <6929121+dr5hn@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: dr5hn <6929121+dr5hn@users.noreply.github.com>
1 parent 71605ea commit 7fc94fd

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bin/Commands/ExportJson.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
7575
$countriesArray[$m]['tld'] = $row['tld'];
7676
$countriesArray[$m]['native'] = $row['native'];
7777
$countriesArray[$m]['region'] = $row['region'];
78-
$countriesArray[$m]['region_id'] = (int)$row['region_id'];
78+
$countriesArray[$m]['region_id'] = $row['region_id'] !== null ? (int)$row['region_id'] : null;
7979
$countriesArray[$m]['subregion'] = $row['subregion'];
80-
$countriesArray[$m]['subregion_id'] = (int)$row['subregion_id'];
80+
$countriesArray[$m]['subregion_id'] = $row['subregion_id'] !== null ? (int)$row['subregion_id'] : null;
8181
$countriesArray[$m]['nationality'] = $row['nationality'];
8282
$countriesArray[$m]['timezones'] = json_decode($row['timezones'], true);
8383
$countriesArray[$m]['translations'] = json_decode($row['translations'], true);
@@ -107,9 +107,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
107107
$countryStateCityArray[$k]['tld'] = $country['tld'];
108108
$countryStateCityArray[$k]['native'] = $country['native'];
109109
$countryStateCityArray[$k]['region'] = $country['region'];
110-
$countryStateCityArray[$k]['region_id'] = (int)$country['region_id'];
110+
$countryStateCityArray[$k]['region_id'] = $country['region_id'] !== null ? (int)$country['region_id'] : null;
111111
$countryStateCityArray[$k]['subregion'] = $country['subregion'];
112-
$countryStateCityArray[$k]['subregion_id'] = (int)$country['subregion_id'];
112+
$countryStateCityArray[$k]['subregion_id'] = $country['subregion_id'] !== null ? (int)$country['subregion_id'] : null;
113113
$countryStateCityArray[$k]['nationality'] = $country['nationality'];
114114
$countryStateCityArray[$k]['timezones'] = $country['timezones'];
115115
$countryStateCityArray[$k]['translations'] = $country['translations'];

0 commit comments

Comments
 (0)