UpdateDatabase.php
authorAlan Knowles <alan@roojs.com>
Fri, 15 Nov 2013 06:18:03 +0000 (14:18 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 15 Nov 2013 06:18:03 +0000 (14:18 +0800)
UpdateDatabase.php

index 4230011..fe9b67c 100644 (file)
@@ -90,10 +90,20 @@ class Pman_Xtuple_UpdateDatabase extends Pman
         
         
     }
-    function importFromArray($db, $file)
+    function jsonImportFromArray($opts)
     {
-        $data= json_decode(file_get_contents($file),true);
-        DB_DataObject::factory('$db')->importFromArray($this);
+        foreach($this->opts as $o=>$v) {
+            if (!preg_match('/^json-/', $o) || empty($v)) {
+                continue;
+            }
+            $type = str_replace('_', '-', substr($o,6));
+            $data= json_decode(file_get_contents($file),true);
+            DB_DataObject::factory($type)->importFromArray($data);
+            
+        }
+        
+        
+        
     }
     
     
@@ -104,13 +114,6 @@ class Pman_Xtuple_UpdateDatabase extends Pman
         $this->opts = $opt;
         
         require_once 'Pman/Core/UpdateDatabase.php';
-        foreach($this->opts as $o=>$v) {
-            if (!preg_match('/^json-/', $o) || empty($v)) {
-                continue;
-            }
-            $type = str_replace('_', '-', substr($o,6));
-            $this->importFromArray($type, $v);
-        }