Browse files

Added null values for columns that don't exist

  • Loading branch information...
1 parent c24e945 commit 54cb82617a9fea69d8fd103f33bcd8366e7a7d2d Dean Sofer committed Jan 14, 2011
Showing with 3 additions and 0 deletions.
  1. +3 −0 models/behaviors/csv.php
View
3 models/behaviors/csv.php
@@ -91,6 +91,9 @@ function importCsv(&$model, $content, $fields = array(), $options = array()) {
while ($row = fgetcsv($file, $options['length'], $options['delimiter'], $options['enclosure'])) {
// for each header field
foreach ($fields as $f => $field) {
+ if (!isset($row[$f])) {
+ $row[$f] = null;
+ }
// get the data field from Model.field
if (strpos($field,'.')) {
$keys = explode('.',$field);

0 comments on commit 54cb826

Please sign in to comment.