Commits

Denis Medved committed 9d34d05

Fix: empty row on value is NULL. Now if value is NULL insert - NULL.

  • Participants
  • Parent commits aa0211c

Comments (0)

Files changed (1)

File gii/fixture/templates/default/fixture.php

 echo '<?php' . PHP_EOL;
 echo 'return array(' . PHP_EOL;
 if(isset($models))
-	foreach ($models as $model){
-		echo '\''.get_class($model).'_'. ++$n . '\' => array(' . PHP_EOL ;
-		foreach ($model->attributes as $attr => $value){
-			echo "\t'" . str_replace("'", "\'", $attr) . "' => '" . str_replace("'", "\'", $value) . "',\n";
-		}
-		echo '),'.PHP_EOL;
-	}
+    foreach ($models as $model){
+        echo '\''.get_class($model).'_'. ++$n . '\' => array(' . PHP_EOL ;
+        foreach ($model->attributes as $attr => $value){
+            echo "\t'" . str_replace("'", "\'", $attr) . "' =>";
+            if(isset($value)){
+                echo "'" . str_replace("'", "\'", $value) . "',\n";
+            }else{
+                echo "NULL,\n";
+            }
+        }
+        echo '),'.PHP_EOL;
+    }
 
 echo ');';