In my bootstrap process, via a few plugins, I also setup the application environment bases upon settings in a config.xml file. These 'global' resources (db connection, environment class, etc) are then stored in the registry so that their values and functionality can be accessed later. How do you make your db connection available to other sections of your code once it has been established?
-----Original Message----- From: Jason Webster [mailto:[email protected]] Sent: Friday, January 09, 2009 3:33 PM To: Zend Framework - General Subject: Re: [fw-general] Is Cal Evan's Globals.php a recommended approach Eh, That's not really what he meant. You (the original poster) may want to take a look at the proposal that is in the works for Zend_Application. <http://framework.zend.com/wiki/display/ZFPROP/Zend_Application+-+Ben+Scholzen> I have been using a Bootstrap/Application class in a couple of projects which I have on the go right now, they can be invaluable for environment specific setup, as you mentioned. Jeremy Brown wrote: > Zend_Registry (http://framework.zend.com/manual/en/zend.registry.html) "is a > container for storing objects and values in the application space. By storing > the value in the registry, the same object is always available throughout > your application. This mechanism is an alternative to using global storage." > > ---- > Jeremy Brown, Zend Certified Engineer (ZCE) > Senior Web Developer > Spear One > 972.661.6038 > www.spearone.com > > > -----Original Message----- > From: swilhelm [mailto:[email protected]] > Sent: Friday, January 09, 2009 2:27 PM > To: [email protected] > Subject: [fw-general] Is Cal Evan's Globals.php a recommended approach > > > I have been Reading Cal Evan's Guide to Zend Framework Programming. > > In it he describes a Globals.php file for creating a single class to > encapsulate access to global resources like the database connection, cache > connection, config, etc. > > This seems useful, particularly if you use it in conjunction with his > Controller_Request_Cli class for exposing some of your Zend-based > application via command line or cron jobs. > > I was wondering if this is the recommended approach to exposing global > resources or is there a Zend Framework "approved" method? > > - Steve W. > -- > View this message in context: > http://www.nabble.com/Is-Cal-Evan%27s-Globals.php-a-recommended-approach-tp21379960p21379960.html > Sent from the Zend Framework mailing list archive at Nabble.com. >
