Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added null values for columns that don't exist

  • Loading branch information...
commit 54cb82617a9fea69d8fd103f33bcd8366e7a7d2d 1 parent c24e945
@ProLoser authored
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);
Please sign in to comment.
Something went wrong with that request. Please try again.