From f1bfc387c8381b40c4e76404601aea7bb542f29c Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 3 Aug 2013 10:53:55 +0300 Subject: [PATCH] sync all models at once --- ipf/auth/app.php | 2 +- ipf/command/syncdb.php | 5 ++++- ipf/orm.php | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/ipf/auth/app.php b/ipf/auth/app.php index 9f362d8..f96181e 100644 --- a/ipf/auth/app.php +++ b/ipf/auth/app.php @@ -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; } diff --git a/ipf/command/syncdb.php b/ipf/command/syncdb.php index 9841e29..70e1670 100644 --- a/ipf/command/syncdb.php +++ b/ipf/command/syncdb.php @@ -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); } } diff --git a/ipf/orm.php b/ipf/orm.php index cdc1bef..00aef16 100644 --- a/ipf/orm.php +++ b/ipf/orm.php @@ -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) -- 2.49.0