Browse Source

dbo deserialize checked if field exists

tags/0.1.1
Robin Thoni 9 years ago
parent
commit
720382ac06
1 changed files with 3 additions and 1 deletions
  1. 3
    1
      src/Generator/dbo.php.twig

+ 3
- 1
src/Generator/dbo.php.twig View File

24
     {
24
     {
25
         $dbo = new {{ dbo_name.camel_upper }}();
25
         $dbo = new {{ dbo_name.camel_upper }}();
26
 {% for column in columns %}
26
 {% for column in columns %}
27
-        $dbo->set{{ column.name.camel_upper }}($json["{{ column.name.camel_upper }}"]);
27
+        if (isset($json["{{ column.name.camel_upper }}"]) {
28
+            $dbo->set{{ column.name.camel_upper }}($json["{{ column.name.camel_upper }}"]);
29
+        }
28
 {% endfor %}
30
 {% endfor %}
29
         return $dbo;
31
         return $dbo;
30
     }
32
     }

Loading…
Cancel
Save