From: Andrey Kutejko Date: Sat, 3 Aug 2013 07:53:55 +0000 (+0300) Subject: sync all models at once X-Git-Tag: 0.5~88 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=f1bfc387c8381b40c4e76404601aea7bb542f29c;p=ipf.git sync all models at once --- 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)