From 21e6f91454193b2f7c1ebfa450c469619b91feaa Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sat, 27 Jul 2013 19:28:09 +0300 Subject: [PATCH] cleanup --- ipf/orm/connection.php | 2 -- ipf/orm/hydrator/recorddriver.php | 2 +- ipf/orm/table.php | 27 +-------------------------- ipf/orm/utils.php | 21 --------------------- 4 files changed, 2 insertions(+), 50 deletions(-) diff --git a/ipf/orm/connection.php b/ipf/orm/connection.php index 8495221..e175652 100644 --- a/ipf/orm/connection.php +++ b/ipf/orm/connection.php @@ -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', diff --git a/ipf/orm/hydrator/recorddriver.php b/ipf/orm/hydrator/recorddriver.php index c415723..df7f498 100644 --- a/ipf/orm/hydrator/recorddriver.php +++ b/ipf/orm/hydrator/recorddriver.php @@ -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); diff --git a/ipf/orm/table.php b/ipf/orm/table.php index 5328b9f..a6a5828 100644 --- a/ipf/orm/table.php +++ b/ipf/orm/table.php @@ -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]; } diff --git a/ipf/orm/utils.php b/ipf/orm/utils.php index c87e16d..e6b55f2 100644 --- a/ipf/orm/utils.php +++ b/ipf/orm/utils.php @@ -125,26 +125,5 @@ class IPF_ORM_Utils { $r[] = ""; 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; - } } -- 2.49.0