user1173169
user1173169

Reputation:

Zend_Db_Table::getDefaultAdapter returns NULL

i'm trying to use

$db = Zend_Db_Table::getDefaultAdapter();

But it returns NULL

I tried to add

resources.db.isDefaultTableAdapter                  = true

in my application.ini but no changes at all...

thanks in advance for your help

Upvotes: 1

Views: 944

Answers (2)

megapixel23
megapixel23

Reputation: 855

Try to add this

SetEnv APPLICATION_ENV development

in the end of file PROJECTNAME\public\.htaccess

Upvotes: 0

phutc
phutc

Reputation: 101

You should add the following function into Bootstrap

protected function _initDatabase() {

    $db = $this->getPluginResource('db')->getDbAdapter();
    Zend_Db_Table::setDefaultAdapter($db); //important
    Zend_Registry::set('db', $db);    

}

Upvotes: 2

Related Questions