Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Critical
-
Resolution: Fixed
-
Affects Version/s: 1.10.0
-
Fix Version/s: 1.10.5
-
Component/s: Zend_Application_Resource
-
Labels:None
Description
When configuring Zend_Application_Resource_Multidb to use a pdo_pgsql adapter as per example in the Programmer's Reference Guide, Zend_Db_Adapter_Pdo_Abstract throws an Zend_Db_Adapter_Exception with the message: SQLSTATE[08006] [7] invalid connection option "adapter"
I based my code on this example: http://framework.zend.com/manual/en/zend.application.available-resources.html#zend.application.available-resources.multidb
The following configuration lines were used:
resources.multidb.db1.adapter = "pdo_pgsql"
resources.multidb.db1.host = "localhost"
resources.multidb.db1.port = 8000
resources.multidb.db1.username = "myUsername"
resources.multidb.db1.password = "myPassword"
resources.multidb.db1.dbname = "myDb"
This problem could be solved if the configuration of Zend_Application_Resource_Multidb would be more similar to Zend_Application_Resource_Db and connection parameters are stored in an array called params. E.g.:
resources.multidb.db1.adapter = "pdo_pgsql"
resources.multidb.db1.params.host = "localhost"
resources.multidb.db1.params.port = 8000
resources.multidb.db1.params.username = "myUsername"
resources.multidb.db1.params.password = "myPassword"
resources.multidb.db1.params.dbname = "myDb"
To maintain backwards compatibility, the following change could be made to Zend_Application_Resource_Multidb and replace line 81:
$this->_dbs[$id] = Zend_Db::factory($params['adapter'], $params);
with the following:
if (isset($params['params'])) { $this->_dbs[$id] = Zend_Db::factory($params['adapter'], $params['params']); } else { $this->_dbs[$id] = Zend_Db::factory($params['adapter'], $params); }
Thank you for reporting this issue. Will evaluate if this should be solved in Zend_Db or in Zend_App.