]> git.andy128k.dev Git - ipf-legacy-orm.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/orm/import/builder.php
ipf/orm/record/abstract.php

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);