]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
make setUp a static method
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 20:55:36 +0000 (23:55 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 20:55:36 +0000 (23:55 +0300)
ipf/orm/import/builder.php
ipf/orm/record.php
ipf/orm/record/abstract.php
ipf/orm/table.php

index 6e3bc0f99d9132e4977cf463e0a587b9b4d56d76..362de0bbdc83ceaedf1da299b141240f6d9671e5 100644 (file)
@@ -135,15 +135,14 @@ class IPF_ORM_Import_Builder
         // then we need call the parent::setUp() before the body of the function
         // Class table inheritance is the only one we shouldn't call parent::setUp() for
         if (count($ret) && isset($definition['inheritance']['type']) && $definition['inheritance']['type'] != 'class_table') {
-            array_unshift($ret, '    parent::setUp();');
+            array_unshift($ret, '    parent::setUp($table);');
         }
 
         // If we have some code for the function then lets define it and return it
         if (count($ret)) {
             array_unshift($ret,
-                '  public function setUp()',
-                '  {',
-                '    $table = $this->getTable();'
+                '  public static function setUp(IPF_ORM_Table $table)',
+                '  {'
             );
             $ret[] = '  }';
         }
index a89718d97451de8a53f8ea439a0002df1320a531..29b0e0dfde4a9632c6a47b5b6fff554b5ce76dad 100644 (file)
@@ -82,7 +82,6 @@ abstract class IPF_ORM_Record extends IPF_ORM_Record_Abstract implements Countab
         return self::$_index;
     }
 
-    public function setUp(){}
     public function construct(){}
 
     public function getOid()
index 3276a677921a3f3c3188db509dbd7bd9141e97c7..63651877624a72513f9a6e90740d06c68cd169dd 100644 (file)
@@ -8,7 +8,7 @@ abstract class IPF_ORM_Record_Abstract extends IPF_ORM_Access
     {
     }
 
-    public function setUp()
+    public static function setUp(IPF_ORM_Table $table)
     {
     }
 
index aec975a2ecd6a07c181432f813f43914a96f00c7..af035c020d9bad4d6005df0018c53e3235eb0b3b 100644 (file)
@@ -65,8 +65,7 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
 
         $this->initIdentifier();
 
-        $record = new $name($this);
-        $record->setUp();
+        $name::setUp($this);
 
         $this->_filters[]  = new IPF_ORM_Record_Filter_Standard();
         $this->_repository = new IPF_ORM_Table_Repository($this);