]> git.andy128k.dev Git - ipf.git/commitdiff
refactor table definition
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 15:51:35 +0000 (18:51 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 15:51:35 +0000 (18:51 +0300)
ipf/admin/models/_generated/BaseAdminLog.php
ipf/auth/models/_generated/BasePermission.php
ipf/auth/models/_generated/BaseRole.php
ipf/auth/models/_generated/BaseRolePermission.php
ipf/auth/models/_generated/BaseUser.php
ipf/auth/models/_generated/BaseUserPermission.php
ipf/auth/models/_generated/BaseUserRole.php
ipf/orm/import/builder.php
ipf/orm/record/abstract.php
ipf/session/models/_generated/BaseSession.php

index a76d24c0cca2720d91a63cd04b11d2b0e418ca11..22f28cfb10c966e7cc84b8837667fbf90da8fc28 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseAdminLog extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('admin_log');
+    $table = $this->getTable();
+    $table->setTableName('admin_log');
     $this->getTable()->setColumn('username', 'string', 32, array('type' => 'string', 'length' => '32'));
     $this->getTable()->setColumn('user_id', 'integer', null, array('type' => 'integer'));
     $this->getTable()->setColumn('object_id', 'integer', null, array('type' => 'integer'));
index 69c7648ada4b394325fc50683c47be21a84e31ae..cf0e609b3f76161b3b0c410d4ee754bdd0d0532f 100644 (file)
@@ -10,7 +10,8 @@ abstract class BasePermission extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('auth_permission');
+    $table = $this->getTable();
+    $table->setTableName('auth_permission');
     $this->getTable()->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'length' => '255'));
     $this->option('type', 'INNODB');
     $this->option('collate', 'utf8_unicode_ci');
index e9bdf4cc41680c1811ce5f89730555cd1c46fe2b..45c8e0590ba58f1ce44523da28ea0e99e3a50808 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseRole extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('auth_role');
+    $table = $this->getTable();
+    $table->setTableName('auth_role');
     $this->getTable()->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'notblank' => true, 'length' => '255'));
     $this->option('type', 'INNODB');
     $this->option('collate', 'utf8_unicode_ci');
index bdf64c51f11c68299e0409a29d445bca4be0636e..e20a9ce7f9adf17b09f6ee0132b9325c3a4f3cb1 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseRolePermission extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('auth_role_permission');
+    $table = $this->getTable();
+    $table->setTableName('auth_role_permission');
     $this->getTable()->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $this->getTable()->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $this->option('type', 'INNODB');
index ba17448bc5a2f48553349caf510d9f992580f58e..aee003b4dc55984445d1b798f3d5535973179c65 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseUser extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('auth_user');
+    $table = $this->getTable();
+    $table->setTableName('auth_user');
     $this->getTable()->setColumn('username', 'string', 32, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'unique' => true, 'length' => '32'));
     $this->getTable()->setColumn('password', 'string', 128, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'length' => '128'));
     $this->getTable()->setColumn('first_name', 'string', 32, array('type' => 'string', 'length' => '32'));
index 227ed05198d75313540568c3e8a392f5fdf7ef7f..0034fbc11c6806552dd68483eef3e7cb42e3f8ed 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseUserPermission extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('auth_user_permission');
+    $table = $this->getTable();
+    $table->setTableName('auth_user_permission');
     $this->getTable()->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $this->getTable()->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $this->option('type', 'INNODB');
index ab9b2ddf85d7ad5f7f051799bf55be551cc1ba94..b49c39c3f15ba5e24ed13083c39fa4fd083c3092 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseUserRole extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('auth_user_role');
+    $table = $this->getTable();
+    $table->setTableName('auth_user_role');
     $this->getTable()->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $this->getTable()->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $this->option('type', 'INNODB');
index 8258b5da4347ee25a3092aa7973cc6aec9092411..1fd3c971ac272b628c71e31229df767df299ba9e 100644 (file)
@@ -23,13 +23,14 @@ class IPF_ORM_Import_Builder
         $ret = array(
             '  public function setTableDefinition()',
             '  {',
+            '    $table = $this->getTable();',
         );
 
         if (isset($definition['inheritance']['type']) && $definition['inheritance']['type'] == 'concrete')
             $ret[] = "    parent::setTableDefinition();";
 
         if (isset($definition['tableName']) && !empty($definition['tableName']))
-            $ret[] = "    ".'$this->setTableName(\''. $definition['tableName'].'\');';
+            $ret[] = "    ".'$table->setTableName(\''. $definition['tableName'].'\');';
 
         if (isset($definition['columns']) && is_array($definition['columns']) && !empty($definition['columns']))
             $ret[] = $this->buildColumns($definition['columns']);
index 41fd7f7a3aef32378044ffef6bd3429a12bd0d33..e03cf839fa6b75fb0483b917b9d8b35e018dcbea 100644 (file)
@@ -29,10 +29,7 @@ abstract class IPF_ORM_Record_Abstract extends IPF_ORM_Access
     {
         $this->_table->setAttribute($attr, $value);
     }
-    public function setTableName($tableName)
-    {
-        $this->_table->setTableName($tableName);
-    }
+
     public function setInheritanceMap($map)
     {
         $this->_table->setOption('inheritanceMap', $map);
index 242e682808b1ba2cd6b7efd0b0ca2404e9eb1552..9498fa0963bf427687288de0901fea1d792ff060 100644 (file)
@@ -10,7 +10,8 @@ abstract class BaseSession extends IPF_ORM_Record
 {
   public function setTableDefinition()
   {
-    $this->setTableName('session');
+    $table = $this->getTable();
+    $table->setTableName('session');
     $this->getTable()->setColumn('session_key', 'string', 40, array('primary' => true, 'type' => 'string', 'length' => '40'));
     $this->getTable()->setColumn('session_data', 'string', null, array('type' => 'string'));
     $this->getTable()->setColumn('expire_data', 'timestamp', null, array('type' => 'timestamp'));