]> git.andy128k.dev Git - ipf.git/commitdiff
make setTableDefinition a static method
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 20:48:59 +0000 (23:48 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 20:48:59 +0000 (23:48 +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/orm/table.php
ipf/session/models/_generated/BaseSession.php

index 6f71fc16d9af3bc81ea3229d4d9d0a69f60857d5..9f55ad4d3a881a89ecc782bc42646a7d617974ca 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseAdminLog extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('admin_log');
     $table->setColumn('username', 'string', 32, array('type' => 'string', 'length' => '32'));
     $table->setColumn('user_id', 'integer', null, array('type' => 'integer'));
index 1e3db8719a284feebe5413411fbd159abd3e6d81..190b33ea5c662316d4e66e7efb3d349e83bbc24a 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BasePermission extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('auth_permission');
     $table->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'length' => '255'));
     $table->setOption('type', 'INNODB');
index 8b956c765a182162642f075cd3c88c70b25300ca..0e72b2459c9f2e453798781350abf3e28112f963 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseRole extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('auth_role');
     $table->setColumn('name', 'string', 255, array('unique' => true, 'type' => 'string', 'notblank' => true, 'length' => '255'));
     $table->setOption('type', 'INNODB');
index 6f58632e786602576219e3f1529ff3a001ba4d28..e01c1defab0f83ac566e3efad7c0a571de96b799 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseRolePermission extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('auth_role_permission');
     $table->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $table->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true));
index e6ca794551f8f49844a1498833cc258ca29303c6..98c8483351537c5753da11d11916213748208a6e 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseUser extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('auth_user');
     $table->setColumn('username', 'string', 32, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'unique' => true, 'length' => '32'));
     $table->setColumn('password', 'string', 128, array('type' => 'string', 'notblank' => true, 'notnull' => true, 'length' => '128'));
index 9c2d55ff9a8caa407f3b0033316eee4386c0a46a..c45e3a63be0c5309552e2cb991601878cf53e795 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseUserPermission extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('auth_user_permission');
     $table->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $table->setColumn('permission_id', 'integer', null, array('type' => 'integer', 'primary' => true));
index f29522e23cde27b2b8b9ccd2ca1983524da2c908..c9d50e0ab0698c4ea6255b85efdf2787d1a06873 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseUserRole extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('auth_user_role');
     $table->setColumn('user_id', 'integer', null, array('type' => 'integer', 'primary' => true));
     $table->setColumn('role_id', 'integer', null, array('type' => 'integer', 'primary' => true));
index 9cf200a7854d2d2c424f2552a842b6a13b5ca0bd..6e3bc0f99d9132e4977cf463e0a587b9b4d56d76 100644 (file)
@@ -21,13 +21,12 @@ class IPF_ORM_Import_Builder
         }
 
         $ret = array(
-            '  public function setTableDefinition()',
+            '  public static function setTableDefinition(IPF_ORM_Table $table)',
             '  {',
-            '    $table = $this->getTable();',
         );
 
         if (isset($definition['inheritance']['type']) && $definition['inheritance']['type'] == 'concrete')
-            $ret[] = "    parent::setTableDefinition();";
+            $ret[] = '    parent::setTableDefinition($table);';
 
         if (isset($definition['tableName']) && !empty($definition['tableName']))
             $ret[] = "    ".'$table->setTableName(\''. $definition['tableName'].'\');';
index dc9f4a7c1006ddc171006dd6944701e25db7443b..3276a677921a3f3c3188db509dbd7bd9141e97c7 100644 (file)
@@ -4,7 +4,7 @@ abstract class IPF_ORM_Record_Abstract extends IPF_ORM_Access
 {
     protected $_table;
 
-    public function setTableDefinition()
+    public static function setTableDefinition(IPF_ORM_Table $table)
     {
     }
 
index e91896a5c168292f046e153d219e8b24e17865ab..aec975a2ecd6a07c181432f813f43914a96f00c7 100644 (file)
@@ -55,8 +55,7 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
         $this->initParents($name);
 
         // create database table
-        $record = new $name($this);
-        $record->setTableDefinition();
+        $name::setTableDefinition($this);
 
         $this->columnCount = count($this->_columns);
 
@@ -66,6 +65,7 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
 
         $this->initIdentifier();
 
+        $record = new $name($this);
         $record->setUp();
 
         $this->_filters[]  = new IPF_ORM_Record_Filter_Standard();
index e321fd7518e2c8efeb3d909ff34119c8a4d01833..98eb6e4520421ed000d577c01aef3d8a5b2d04a0 100644 (file)
@@ -8,9 +8,8 @@
 
 abstract class BaseSession extends IPF_ORM_Record
 {
-  public function setTableDefinition()
+  public static function setTableDefinition(IPF_ORM_Table $table)
   {
-    $table = $this->getTable();
     $table->setTableName('session');
     $table->setColumn('session_key', 'string', 40, array('primary' => true, 'type' => 'string', 'length' => '40'));
     $table->setColumn('session_data', 'string', null, array('type' => 'string'));