Browse Source

fixed null data array to empty array

tags/0.1.3^0
Robin Thoni 8 years ago
parent
commit
716f194b88
1 changed files with 4 additions and 0 deletions
  1. 4
    0
      src/Generator/sp.php.twig

+ 4
- 0
src/Generator/sp.php.twig View File

@@ -49,6 +49,10 @@ class {{ sp.sp_name.camel_upper }} extends LuSpModel {
49 49
         $values = DB::select('SELECT (SELECT count(*) FROM {{ spcall }}) as count, (SELECT json_agg(q) FROM (SELECT * FROM {{ spcall }} OFFSET (:page::int * :perPage::int) LIMIT :perPage) q) as data',
50 50
             array({{ argsarray }}, ":page" => $page, ":perPage" => $perPage));
51 51
         $value = $values[0];
52
+        if (is_null($value->data))
53
+        {
54
+            $value->data = '[]';
55
+        }
52 56
         $data = LuStringUtils::convertJsonString($value->data);
53 57
         return new LuMultipleDbo($value->count, $data);
54 58
     }

Loading…
Cancel
Save