From: Andrey Kutejko Date: Sat, 27 Jul 2013 20:55:36 +0000 (+0300) Subject: make setUp a static method X-Git-Tag: 0.6~49 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=19d926d8d5cd93b8155c652279a851036d9132d4;p=ipf-legacy-orm.git make setUp a static method --- diff --git a/ipf/orm/import/builder.php b/ipf/orm/import/builder.php index 6e3bc0f..362de0b 100644 --- a/ipf/orm/import/builder.php +++ b/ipf/orm/import/builder.php @@ -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[] = ' }'; } diff --git a/ipf/orm/record.php b/ipf/orm/record.php index a89718d..29b0e0d 100644 --- a/ipf/orm/record.php +++ b/ipf/orm/record.php @@ -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() diff --git a/ipf/orm/record/abstract.php b/ipf/orm/record/abstract.php index 3276a67..6365187 100644 --- a/ipf/orm/record/abstract.php +++ b/ipf/orm/record/abstract.php @@ -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) { } diff --git a/ipf/orm/table.php b/ipf/orm/table.php index aec975a..af035c0 100644 --- a/ipf/orm/table.php +++ b/ipf/orm/table.php @@ -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);