« Return to Thread: Dumb Question

RE: Dumb Question

by Fullarton, Daniel :: Rate this Message:

Reply to Author | View in Thread

RE: [fw-general] Dumb Question

AFAIK It is not global by default, you could probably find a few neater ways to do this but I just use

Zend_Db_Table_Abstract::setDefaultAdapter($db);

(this also sets up for any Zend DB Tables you may/may not have) and then use

Zend_Db_Table_Abstract::getDefaultAdapter();

to get it from your controllers.

I'm sure there must be a lighter way to do it without requiring that static method.

- Daniel Fullarton



-----Original Message-----
From: Joseph Crawford [codebowl@...]
Sent: Thu 5/15/2008 11:16 PM
To: fw-general@...
Subject: [fw-general] Dumb Question

In my index.php bootstrap file I setup the database connection into a 
variable $db.  Now I need to access this in other controllers.  This 
seems like a dumb question to me but do I need to global $db; before I 
can access it in the indexAction method of the controller or is it in 
the global scope by default?

Thanks,
Joseph Crawford

 « Return to Thread: Dumb Question

LightInTheBox - Buy quality products at wholesale price