]> git.andy128k.dev Git - ipf.git/commitdiff
sync all models at once
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 3 Aug 2013 07:53:55 +0000 (10:53 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 3 Aug 2013 07:53:55 +0000 (10:53 +0300)
ipf/auth/app.php
ipf/command/syncdb.php
ipf/orm.php

index 9f362d8c661427d46a54b923e2eff601ae58fbcf..f96181e87ec11d162813eb41129b58e041158356 100644 (file)
@@ -80,7 +80,7 @@ class IPF_Auth_App extends IPF_Application
                 $export->dropTable(IPF_ORM::getTable('UserRole')->getTableName());
                 $export->dropTable(IPF_ORM::getTable('UserPermission')->getTableName());
                 $auth_app = new IPF_Auth_App();
-                IPF_ORM::createTablesFromModels($auth_app);
+                IPF_ORM::createTablesFromModels($auth_app->modelList());
 
                 $toAdd = $permissions;
             }
index 9841e294f1366e297a8cc06df926106fa8dfeada..70e16704a97c097aecc68ac4d1b6a6ddffeeeea8 100644 (file)
@@ -11,8 +11,11 @@ class IPF_Command_SyncDB
 
         $project = IPF_Project::getInstance();
 
+        $models = array();
         foreach ($project->appList() as $app)
-            IPF_ORM::createTablesFromModels($app);
+            $models = array_merge($models, $app->modelList());
+
+        IPF_ORM::createTablesFromModels($models);
     }
 }
 
index cdc1bef8584911b56e2beaeb0672b538494da195..00aef1602e61dc8b9350a290efea569e9f4d595f 100644 (file)
@@ -196,9 +196,9 @@ final class IPF_ORM
         return $models;
     }
 
-    public static function createTablesFromModels($app)
+    public static function createTablesFromModels($models)
     {
-        IPF_ORM_Manager::connection()->export->exportClasses($app->modelList());
+        IPF_ORM_Manager::connection()->export->exportClasses($models);
     }
 
     public static function generateSqlFromModels($app)