]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
cleanup
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 16:28:09 +0000 (19:28 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 27 Jul 2013 16:28:09 +0000 (19:28 +0300)
ipf/orm/connection.php
ipf/orm/hydrator/recorddriver.php
ipf/orm/table.php
ipf/orm/utils.php

index 8495221ca4021d4e32cc52b9b870f014afe18a53..e1756521e88f97c99956261c4e6dda8c95f7e086 100644 (file)
@@ -7,7 +7,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta
     protected $_name;
     protected $driverName;
     protected $isConnected      = false;
-    protected $supported        = array();
     protected $pendingAttributes  = array();
 
     private $modules = array('transaction' => false,
@@ -27,7 +26,6 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta
                                   'varchar_max_length'  => 255,
                                   );
 
-    protected $serverInfo = array();
     protected $options    = array();
     private static $availableDrivers    = array(
                                         'Mysql',
index c415723e4656bedffa37c3e0645e781cf05b9499..df7f498c4605f4037fbd70e72dbf81eb2c86b109 100644 (file)
@@ -71,7 +71,7 @@ class IPF_ORM_Hydrator_RecordDriver
         $this->_tables = null;
     }
     
-    protected function _getClassnameToReturn(array &$data, $component)
+    protected function _getClassNameToReturn(array &$data, $component)
     {
         if ( ! isset($this->_tables[$component])) {
             $this->_tables[$component] = IPF_ORM::getTable($component);
index 5328b9ff0c3c8a82348bd6b833a63672baed38b6..a6a582826358a0b0c595ea94749731aae6642c83 100644 (file)
@@ -174,7 +174,6 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
     public function getTemplates()
     {
         return $this->_templates;
-
     }
 
     public function getExportableFormat($parseForeignKeys = true)
@@ -749,28 +748,6 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
         return $record;
     }
 
-    public function getClassnameToReturn()
-    {
-        if ( ! isset($this->_options['subclasses'])) {
-            return $this->_options['name'];
-        }
-        foreach ($this->_options['subclasses'] as $subclass) {
-            $table = $this->_conn->getTable($subclass);
-            $inheritanceMap = $table->getOption('inheritanceMap');
-            $nomatch = false;
-            foreach ($inheritanceMap as $key => $value) {
-                if ( ! isset($this->_data[$key]) || $this->_data[$key] != $value) {
-                    $nomatch = true;
-                    break;
-                }
-            }
-            if ( ! $nomatch) {
-                return $table->getComponentName();
-            }
-        }
-        return $this->_options['name'];
-    }
-
     final public function getProxy($id = null)
     {
         if ($id !== null) {
@@ -985,10 +962,8 @@ class IPF_ORM_Table extends IPF_ORM_Configurable implements Countable
 
     public function getTemplate($template)
     {
-        if ( ! isset($this->_templates[$template])) {
+        if (!isset($this->_templates[$template]))
             throw new IPF_ORM_Exception('Template ' . $template . ' not loaded');
-        }
-
         return $this->_templates[$template];
     }
 
index c87e16dc17ad7b0031828a83fa0324ad4acbd981..e6b55f29573cbcfae98b712efaee1261b84799e2 100644 (file)
@@ -125,26 +125,5 @@ class IPF_ORM_Utils {
         $r[] = "</pre>";
         return implode("\n",$r);
     }
-
-    static function setOrd($obj, $field_name='ord', $where=null, $params=null){
-        $res = null;
-        if ($where){
-            $res = IPF_ORM_Query::create()
-                ->select("max($field_name) as max_ord")
-                ->from($obj->getTable()->getClassnameToReturn())
-                ->where($where, $params)
-                ->execute();
-        }
-        else{
-            $res = IPF_ORM_Query::create()
-                ->select("max($field_name) as max_ord")
-                ->from($obj->getTable()->getClassnameToReturn())
-                ->execute();
-        }
-        if (isset($res[0]['max_ord']))
-            $obj->$field_name = (int)$res[0]->max_ord + 1;
-        else
-            $obj->$field_name = 1;
-    }
 }