Browse Source

[ZF-12466] Fix table adapter injection

Forward port r25122


git-svn-id: http://framework.zend.com/svn/framework/standard/branches/release-1.12@25123 44c647ce-9c0f-0410-b52a-842ac1e357ba
matthew 13 years ago
parent
commit
dc5e8261e8
1 changed files with 6 additions and 3 deletions
  1. 6 3
      library/Zend/Application/Resource/Db.php

+ 6 - 3
library/Zend/Application/Resource/Db.php

@@ -139,10 +139,13 @@ class Zend_Application_Resource_Db extends Zend_Application_Resource_ResourceAbs
         if ((null === $this->_db)
             && (null !== ($adapter = $this->getAdapter()))
         ) {
-            if ($this->isDefaultTableAdapter()) {
-                Zend_Db_Table::setDefaultAdapter($adapter);
-            }
             $this->_db = Zend_Db::factory($adapter, $this->getParams());
+
+            if ($this->_db instanceof Zend_Db_Adapter_Abstract 
+                && $this->isDefaultTableAdapter()
+            ) {
+                Zend_Db_Table::setDefaultAdapter($this->_db);
+            }
         }
         return $this->_db;
     }