]> git.andy128k.dev Git - ipf.git/commitdiff
refactor attribute and option definitions
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 17:57:48 +0000 (20:57 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 17:57:48 +0000 (20:57 +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

index 2dd2a7567a1fab46102c95368a9430271e3bfab5..264672ffe3d7ebcc64e8b2bb1c8c2b0448ed3a3d 100644 (file)
@@ -23,9 +23,9 @@ abstract class BaseAdminLog extends IPF_ORM_Record
     $table->addIndex('idx_object_class', array('fields' => 'object_class'));
     $table->addIndex('idx_created_at', array('fields' => 'created_at'));
     $table->addIndex('idx_action_flag', array('fields' => 'action_flag'));
-    $this->option('type', 'INNODB');
-    $this->option('collate', 'utf8_unicode_ci');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index cf0e609b3f76161b3b0c410d4ee754bdd0d0532f..832cdbf8b37ec78195699d80be2d3cd2d3d1f8f2 100644 (file)
@@ -13,9 +13,9 @@ abstract class BasePermission extends IPF_ORM_Record
     $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');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index 45c8e0590ba58f1ce44523da28ea0e99e3a50808..79bc9fbbabfe33d861b971dfd8e82f097f0f6f69 100644 (file)
@@ -13,9 +13,9 @@ abstract class BaseRole extends IPF_ORM_Record
     $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');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index e20a9ce7f9adf17b09f6ee0132b9325c3a4f3cb1..67b6eb7b78b0486eb3ae51111a59c546dd0d453f 100644 (file)
@@ -14,9 +14,9 @@ abstract class BaseRolePermission extends IPF_ORM_Record
     $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');
-    $this->option('collate', 'utf8_unicode_ci');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index aee003b4dc55984445d1b798f3d5535973179c65..c11f08cd3bd77bdfa9f89fe1162dc234ffda73fb 100644 (file)
@@ -21,9 +21,9 @@ abstract class BaseUser extends IPF_ORM_Record
     $this->getTable()->setColumn('is_active', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false));
     $this->getTable()->setColumn('is_superuser', 'boolean', null, array('type' => 'boolean', 'notnull' => true, 'default' => false));
     $this->getTable()->setColumn('last_login', 'timestamp', null, array('type' => 'timestamp'));
-    $this->option('type', 'INNODB');
-    $this->option('collate', 'utf8_unicode_ci');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index 0034fbc11c6806552dd68483eef3e7cb42e3f8ed..827c84a682c0c616e5709afd053e01cd83d7777d 100644 (file)
@@ -14,9 +14,9 @@ abstract class BaseUserPermission extends IPF_ORM_Record
     $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');
-    $this->option('collate', 'utf8_unicode_ci');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index b49c39c3f15ba5e24ed13083c39fa4fd083c3092..5905cbb2711e5f92bacb595ecbaac0e8976bafbf 100644 (file)
@@ -14,9 +14,9 @@ abstract class BaseUserRole extends IPF_ORM_Record
     $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');
-    $this->option('collate', 'utf8_unicode_ci');
-    $this->option('charset', 'utf8');
+    $table->setOption('type', 'INNODB');
+    $table->setOption('collate', 'utf8_unicode_ci');
+    $table->setOption('charset', 'utf8');
 
   }
 
index bdb172831e33b8d0a98da8dd019933fec3681bcc..3be0494ff0b428faf4c44f9a87257ea934379d35 100644 (file)
@@ -293,7 +293,7 @@ class IPF_ORM_Import_Builder
                 $values = substr($values, 0, strlen($values) - 3);
             }
 
-            $build .= "    \$this->setAttribute(IPF_ORM::ATTR_" . strtoupper($key) . ", " . $values . ");" . PHP_EOL;
+            $build .= "    \$table->setAttribute(IPF_ORM::ATTR_" . strtoupper($key) . ", " . $values . ");" . PHP_EOL;
         }
 
         return $build;
@@ -303,9 +303,8 @@ class IPF_ORM_Import_Builder
     {
         $build = '';
         foreach ($options as $name => $value) {
-            $build .= "    \$this->option('$name', " . self::varExport($value) . ");" . PHP_EOL;
+            $build .= "    \$table->setOption('$name', " . self::varExport($value) . ");" . PHP_EOL;
         }
-
         return $build;
     }
 
index 29058f284c3d4733474750bfbdaa8bdcd12c5026..1a1cbf7337bab7dd4ef82ea5caaaf58b8f97a448 100644 (file)
@@ -17,11 +17,6 @@ abstract class IPF_ORM_Record_Abstract extends IPF_ORM_Access
         return $this->_table;
     }
 
-    public function setAttribute($attr, $value)
-    {
-        $this->_table->setAttribute($attr, $value);
-    }
-
     public function setInheritanceMap($map)
     {
         $this->_table->setOption('inheritanceMap', $map);
@@ -51,21 +46,6 @@ abstract class IPF_ORM_Record_Abstract extends IPF_ORM_Access
         }    
     }
 
-    public function option($name, $value = null)
-    {
-        if ($value === null) {
-            if (is_array($name)) {
-                foreach ($name as $k => $v) {
-                    $this->_table->setOption($k, $v);
-                }
-            } else {
-                return $this->_table->getOption($name);
-            }
-        } else {
-            $this->_table->setOption($name, $value);
-        }
-    }
-
     public function ownsOne()
     {
         $this->_table->bind(func_get_args(), IPF_ORM_Relation::ONE_COMPOSITE);