2009年10月4日星期日

Re: [fw-db] Fatal error: Uncaught exception 'Zend_Db_Exception' with message 'Adapter name must be specified in a string'

1.) Howto var dump?
Hi Duo could you teach me how to do the var dump thing correctly?  I'm a PHP newbie, every view page gives me that Fatal error message.  I don't know how to force a var dump into an Error view page.  I tried to put the "Zend_Debug::dump();" into Bootstrap but nothing new happens. 

View page - Fatal error
http://pastebin.com/m63b8f8d

Bootstrap
 - Zend_Debug::dump()
http://pastebin.com/m3e88b3f6

I made the changes at pastebin, but I copied the relevant part below again for you here:

Inside _initRegDatabase

$this->bootstrap('RegConfig'); $config = Zend_Registry::get('config'); Zend_Debug::dump($config->db); exit;

Try this and you should see some kind of output. Let me know if that helps.

On Oct 4, 2009, at 3:10 PM, W Itch wrote:

1.) Howto var dump?
Hi Duo could you teach me how to do the var dump thing correctly?  I'm a PHP newbie, every view page gives me that Fatal error message.  I don't know how to force a var dump into an Error view page.  I tried to put the "Zend_Debug::dump();" into Bootstrap but nothing new happens.

View page - Fatal error
http://pastebin.com/m63b8f8d

Bootstrap
- Zend_Debug::dump()
http://pastebin.com/m3e88b3f6

___________________________________________________________________________


2.) The story
My web application is 99% based on Akrabats tutorial in case this information helps.
http://akrabat.com/zend-framework-tutorial/

The Akrabat Bootstrap file looks like this.  And _initAutoload() function usually starts up the config.ini file and database connection.
http://pastebin.com/m3e88b3f6

application/configs/application.ini
http://pastebin.com/m4c2fd8a3


So my _initRegDatabase() function seems redundant.  Do you think that I need to set the config and database into registry by working within _initAutoload() function instead?  By using the Zend_Application_Module_Autoloader somehow some way?


/apprentice











On Sun, Oct 4, 2009 at 7:57 PM, Duo Zheng <duozheng@gmail.com> wrote:
apprentice,
What is the var dump output on $config->db? Check the format of it against the proper format listed in the reference manual(http://framework.zend.com/manual/en/zend.db.html#zend.db.adapter.connecting.factory-config). 

Regards,
Duo

On Oct 4, 2009, at 6:16 AM, W Itch wrote:

Fatal error: Uncaught exception 'Zend_Db_Exception' with message 'Adapter name must be specified in a string'

I've been googling this problem but can't find any hints to follow.  Can somebody help me fix this Error?
The code that is causing this error is this:


Bootstrap

    protected function _initRegDatabase()
    {
    $config = Zend_Registry::get('config');
       
        $db = Zend_Db::factory($config->db);                            //   This line seems to cause the Error!
        Zend_Db_Table_Abstract::setDefaultAdapter($db);
        Zend_Registry::set('db', $db);
    }


/apprentice



没有评论: