ZF-11779: Fatal error: Call to a member function describeTable() on a non-object in /usr/share/pear/Zend/Db/Table/Abstract.php on line 835

Description

I'm using MultiDb to enable use several different banks in the same application, I made a model and specified the attribute (adapter $ this-> _db = 'db2';) and rushed this Fatal Error.

  • I made the correction in the method "_setupDatabaseAdapter" inserted just an alternative "else";

==================================

protected function _setupDatabaseAdapter()
{
    if (! $this->_db) {
        $this->_db = self::getDefaultAdapter();
        if (!$this->_db instanceof Zend_Db_Adapter_Abstract) {
            require_once 'Zend/Db/Table/Exception.php';
            throw new Zend_Db_Table_Exception('No adapter found for ' . get_class($this));
        }
    //correction zend db class to consider the adpter which was set in the model
    } else if(is_string($this->_db)) {
        if (Zend_Registry::isRegistered($this->_db)) {
            $this->_db = Zend_Registry::get($this->_db);
        }
    }
}

===================================

Comments

No comments to display