简体   繁体   中英

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

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);    

}

Try to add this

SetEnv APPLICATION_ENV development

in the end of file PROJECTNAME\\public\\.htaccess

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM