Skip to content

Commit 4e15c7e

Browse files
committed
Add phone codes to countries seed data and fix empty string vs NULL
- Populate phone_code column in countries.csv with ITU-T E.164 codes - Convert empty strings to NULL for nullable fields in CountriesSeed - Fix EmptyValuesTestFilterCollection callback to return bool The phone_code column was empty for all countries, making the empty-values search demo non-functional. The seed also inserted empty strings instead of NULL, so IS NULL filters never matched.
1 parent 9196be4 commit 4e15c7e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

config/Seeds/CountriesSeed.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,16 @@ public function run(): void {
2323
$handle = fopen($file, 'r');
2424
$headers = fgetcsv($handle, null, ',', '"', '\\');
2525
$rows = [];
26+
$nullableFields = ['phone_code', 'zip_regexp', 'address_format', 'timezone'];
2627
while (($data = fgetcsv($handle, 1000, ',', '"', '\\')) !== false) {
2728
$row = array_combine($headers, $data);
2829
unset($row['continent_id']);
2930
$row['special'] = '';
31+
foreach ($nullableFields as $field) {
32+
if (isset($row[$field]) && $row[$field] === '') {
33+
$row[$field] = null;
34+
}
35+
}
3036
$rows[] = $row;
3137
}
3238
fclose($handle);

0 commit comments

Comments
 (0)