Re: green bean question on singleton php5
| From: | Eric Butera | Date: | Wed, 16 Jan 2008 22:09:19 +0000 |
| Subject: | Re: green bean question on singleton php5 | ||
| References: | 1 2 3 4 5 6 7 8 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267454@lists.php.net to get a copy of this message | ||
On Jan 16, 2008 5:06 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote:
> On Jan 16, 2008 4:55 PM, Jochem Maas <jochem@iamjochem.com> wrote:
>
> > Eric Butera schreef:
> >
> >
> >
> >
> > > I still don't understand the obsession of a singleton in regards to a
> > > db connection. Using a registry is a much better practice I think.
> > >
> >
> > I think I alluded to the registry pattern in my reply above - although I'm
> not
> > sure. could you care to ellaborate what you mean by registry?
> >
>
> though i havent seen registry defined in any of the few patterns books ive
> seen;
> i think its supposed to be a list of singletons, essentially; if you want a
> 'global'
> registry that is. and i suppose the registry class would itself be a
> singleton as well.
> here is a somewhat concrete definition / explanation / example..
> http://www.phppatterns.com/doku.php/design/the_registry
>
> -nathan
>
Here is an implementation:
http://framework.zend.com/manual/en/zend.registry.html
Here is another:
http://www.stubbles.net/browser/trunk/src/main/php/net/stubbles/util/stubRegistry.php