From: Andrey Kutejko Date: Sat, 27 Jul 2013 17:57:48 +0000 (+0300) Subject: refactor attribute and option definitions X-Git-Tag: 0.6~56 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=29874f8a2b17a829c4b3d6e50bfef88a78fd66e0;p=ipf-legacy-orm.git refactor attribute and option definitions --- diff --git a/ipf/orm/import/builder.php b/ipf/orm/import/builder.php index bdb1728..3be0494 100644 --- a/ipf/orm/import/builder.php +++ b/ipf/orm/import/builder.php @@ -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; } diff --git a/ipf/orm/record/abstract.php b/ipf/orm/record/abstract.php index 29058f2..1a1cbf7 100644 --- a/ipf/orm/record/abstract.php +++ b/ipf/orm/record/abstract.php @@ -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);