]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
cleanup
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 8 Jun 2013 18:05:21 +0000 (21:05 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 8 Jun 2013 18:05:21 +0000 (21:05 +0300)
ipf/orm/adapter.php
ipf/orm/connection.php
ipf/orm/manager.php
ipf/orm/overloadable.php [deleted file]
ipf/orm/query.php
ipf/orm/query/abstract.php

index 06b9b5189cb2c28b409467c24d5c52239d1f2069..1ca145acfc721d0ea9f664d35ec2093215e34b91 100644 (file)
@@ -71,4 +71,4 @@ class IPF_ORM_Adapter
     const PARAM_NULL = 0;
     const PARAM_STMT = 4;
     const PARAM_STR = 2;
-}
\ No newline at end of file
+}
index 0d161a0aa0db350d789ab12fbb0c742f43fa7d27..13c2c82aed9c5fbf3f43a6ae301062e111d133e7 100644 (file)
@@ -50,13 +50,11 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta
     public function __construct(IPF_ORM_Manager $manager, $adapter, $user = null, $pass = null)
     {
         if (is_object($adapter)) {
-            if ( ! ($adapter instanceof PDO) && ! in_array('IPF_ORM_Adapter_Interface', class_implements($adapter))) {
-                throw new IPF_ORM_Exception('First argument should be an instance of PDO or implement IPF_ORM_Adapter_Interface');
+            if (!($adapter instanceof PDO)) {
+                throw new IPF_ORM_Exception('First argument should be an instance of PDO');
             }
             $this->dbh = $adapter;
-
             $this->isConnected = true;
-
         } else if (is_array($adapter)) {
             $this->pendingAttributes[IPF_ORM::ATTR_DRIVER_NAME] = $adapter['scheme'];
 
index 4e64efdd02388c0c87eeb244e19c17c5da7209ff..93dfa1372b897fa2c907948af6f5fc3e7eb73363 100644 (file)
@@ -60,9 +60,9 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato
 
     public function getQueryRegistry()
     {
-       if ( ! isset($this->_queryRegistry)) {
-          $this->_queryRegistry = new IPF_ORM_Query_Registry;
-       }
+        if ( ! isset($this->_queryRegistry)) {
+            $this->_queryRegistry = new IPF_ORM_Query_Registry;
+        }
         return $this->_queryRegistry;
     }
 
@@ -73,23 +73,17 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato
         return $this;
     }
 
-    public static function connection($adapter = null, $name = null)
+    public static function connection()
     {
-        if ($adapter == null) {
-            return IPF_ORM_Manager::getInstance()->getCurrentConnection();
-        } else {
-            return IPF_ORM_Manager::getInstance()->openConnection($adapter, $name);
-        }
+        return IPF_ORM_Manager::getInstance()->getCurrentConnection();
     }
 
     public function openConnection($adapter, $name = null, $setCurrent = true, $persistent = false)
     {
         if (is_object($adapter)) {
-            if ( ! ($adapter instanceof PDO) && ! in_array('IPF_ORM_Adapter_Interface', class_implements($adapter))) {
-                throw new IPF_ORM_Exception("First argument should be an instance of PDO or implement IPF_ORM_Adapter_Interface");
-            }
-
-            $driverName = $adapter->getAttribute(IPF_ORM::ATTR_DRIVER_NAME);
+            if (!($adapter instanceof PDO))
+                throw new IPF_ORM_Exception("First argument should be an instance of PDO");
+            $driverName = $adapter->getAttribute(PDO::ATTR_DRIVER_NAME);
         } else if (is_array($adapter)) {
             if ( ! isset($adapter[0])) {
                 throw new IPF_ORM_Exception('Empty data source name given.');
diff --git a/ipf/orm/overloadable.php b/ipf/orm/overloadable.php
deleted file mode 100644 (file)
index a1175c3..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-interface IPF_ORM_Overloadable {
-    public function __call($m, $a);
-}
\ No newline at end of file
index 29fb6188dcfe371dbf1ccdf02846142e0bc0b796..7124026a66db8d8212f94e39b770e03dea22ff82 100644 (file)
@@ -80,7 +80,6 @@ class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Seriali
         $this->_expressionMap = array();
         $this->_subqueryAliases = array();
         $this->_needsSubquery = false;
-        $this->_isLimitSubqueryUsed = false;
     }
 
     public function createSubquery()
@@ -769,7 +768,6 @@ class IPF_ORM_Query extends IPF_ORM_Query_Abstract implements Countable, Seriali
 
         if ( ! empty($this->_sqlParts['limit']) && $this->_needsSubquery &&
                 $table->getAttribute(IPF_ORM::ATTR_QUERY_LIMIT) == IPF_ORM::LIMIT_RECORDS) {
-            $this->_isLimitSubqueryUsed = true;
             $needsSubQuery = true;
         }
 
index 93b52af03da14f5a98b4d5e0d6d4f7776f25cc6e..d6149da75fb6a299f1530f339040bd94098e594a 100644 (file)
@@ -71,7 +71,6 @@ abstract class IPF_ORM_Query_Abstract
                             );
     protected $_enumParams = array();
 
-    protected $_isLimitSubqueryUsed = false;
     protected $_pendingSetParams = array();
     protected $_components;
     protected $_preQueried = false;
@@ -229,11 +228,6 @@ abstract class IPF_ORM_Query_Abstract
         return $this->_view;
     }
 
-    public function isLimitSubqueryUsed()
-    {
-        return $this->_isLimitSubqueryUsed;
-    }
-
     public function convertEnums($params)
     {
         $table = $this->getRoot();
@@ -462,11 +456,6 @@ abstract class IPF_ORM_Query_Abstract
             $query = $this->_view->getSelectSql();
         }
 
-        if ($this->isLimitSubqueryUsed() &&
-                $this->_conn->getAttribute(IPF_ORM::ATTR_DRIVER_NAME) !== 'mysql') {
-            $params = array_merge($params, $params);
-        }
-
         if ($this->_type !== self::SELECT) {
             return $this->_conn->exec($query, $params);
         }