]> git.andy128k.dev Git - ipf-legacy-orm.git/commitdiff
always throw exception on DB error
authorAndrey Kutejko <andy128k@gmail.com>
Sat, 8 Jun 2013 20:01:31 +0000 (23:01 +0300)
committerAndrey Kutejko <andy128k@gmail.com>
Sat, 8 Jun 2013 20:01:31 +0000 (23:01 +0300)
ipf/orm.php
ipf/orm/configurable.php
ipf/orm/connection.php
ipf/orm/manager.php

index 5f5211933633194b1b183da1ce75c97b6c6a0b65..d3427c36e2b310191b8c9b505afb6e28d7d8a025 100644 (file)
@@ -129,7 +129,6 @@ final class IPF_ORM {
     const ATTR_CACHE_LIFESPAN           = 151;
     const ATTR_RESULT_CACHE_LIFESPAN    = 151;
     const ATTR_LOAD_REFERENCES          = 153;
-    const ATTR_THROW_EXCEPTIONS         = 155;
     const ATTR_DEFAULT_PARAM_NAMESPACE  = 156;
     const ATTR_QUERY_CACHE              = 157;
     const ATTR_QUERY_CACHE_LIFESPAN     = 158;
index 2a2e7593c89fe7e15117c2071451e45917c28f0a..6d448e1d5c7fbba6388e3d365e021d187070ff2d 100644 (file)
@@ -71,7 +71,6 @@ abstract class IPF_ORM_Configurable extends IPF_ORM_Locator_Injectable
             case IPF_ORM::ATTR_EXPORT:
             case IPF_ORM::ATTR_DECIMAL_PLACES:
             case IPF_ORM::ATTR_LOAD_REFERENCES:
-            case IPF_ORM::ATTR_THROW_EXCEPTIONS:
             case IPF_ORM::ATTR_DEFAULT_PARAM_NAMESPACE:
             case IPF_ORM::ATTR_AUTOLOAD_TABLE_CLASSES:
             case IPF_ORM::ATTR_MODEL_LOADING:
index 9a4b4f143486e686ccd301deeefd35a397976a42..79569489128abaeebeebed3136746c0e4df677a0 100644 (file)
@@ -548,22 +548,15 @@ abstract class IPF_ORM_Connection extends IPF_ORM_Configurable implements Counta
     public function rethrowException(Exception $e, $invoker)
     {
         $event = new IPF_ORM_Event($this, IPF_ORM_Event::CONN_ERROR);
+        $this->notifyDBListeners('onError', $event);
 
-        $this->notifyDBListeners('preError', $event);
-        
         $name = 'IPF_ORM_Exception_' . $this->driverName;
-
         $exc  = new $name($e->getMessage(), (int) $e->getCode());
-        if ( ! is_array($e->errorInfo)) {
+        if (!is_array($e->errorInfo)) {
             $e->errorInfo = array(null, null, null, null);
         }
         $exc->processErrorInfo($e->errorInfo);
-
-         if ($this->getAttribute(IPF_ORM::ATTR_THROW_EXCEPTIONS)) {
-            throw $exc;
-        }
-        
-        $this->notifyDBListeners('postError', $event);
+        throw $exc;
     }
 
     public function hasTable($name)
index b76b5b0857c7e3830ea05724a33855c372c8e1b6..64694907eb620965fd418a4a2da47a5f855afb13 100644 (file)
@@ -24,7 +24,6 @@ class IPF_ORM_Manager extends IPF_ORM_Configurable implements Countable, Iterato
                         IPF_ORM::ATTR_RESULT_CACHE             => null,
                         IPF_ORM::ATTR_QUERY_CACHE              => null,
                         IPF_ORM::ATTR_LOAD_REFERENCES          => true,
-                        IPF_ORM::ATTR_THROW_EXCEPTIONS         => true,
                         IPF_ORM::ATTR_IDXNAME_FORMAT           => "%s_idx",
                         IPF_ORM::ATTR_SEQNAME_FORMAT           => "%s_seq",
                         IPF_ORM::ATTR_TBLNAME_FORMAT           => "%s",