diff --git a/composer.json b/composer.json index 8c2b642..938b9a1 100644 --- a/composer.json +++ b/composer.json @@ -4,7 +4,7 @@ "type": "library", "license": "MIT", "require": { - "robmorgan/phinx": "^0.8.1||^0.9.0||^0.10.0" + "robmorgan/phinx": "^0.11" }, "require-dev": { "phpunit/phpunit": "^5.7" diff --git a/src/CsvSeeder.php b/src/CsvSeeder.php index f94115b..2b47da6 100644 --- a/src/CsvSeeder.php +++ b/src/CsvSeeder.php @@ -110,6 +110,10 @@ private function buildToInsertArray($csvRows, $mapping) for ($i = $offset; $i < count($csvRows); $i++) { $temp = []; foreach ($mapping as $key => $value) { + // replace empty csv columns with null + if (empty($csvRows[$i][$key])) { + $csvRows[$i][$key] = null; + } $temp[$value] = $csvRows[$i][$key]; } $toBuild[] = $temp;