Re: green bean question on singleton php5
| From: | Jochem Maas | Date: | Wed, 16 Jan 2008 21:55:17 +0000 |
| Subject: | Re: green bean question on singleton php5 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-267448@lists.php.net to get a copy of this message | ||
Eric Butera schreef:
On Jan 16, 2008 4:13 PM, Nathan Nobbe <quickshiftin@gmail.com> wrote: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?On Jan 16, 2008 3:59 PM, Jochem Maas <jochem@iamjochem.com> wrote: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.given that dbaccess doesn't extend mysqli instantiation of dbaccess is completely pointless no?i dont know; i think using an instance of dbaccess to control a single instance of the mysqli class is appropriate. personally, i wouldnt extend mysqli unless i had a good reason to. i would probly only rationalize this if i wanted to override some of the behavior in a specific way, or extend it in some meaningful way (even then i might use composition). if that isnt the intention i think composition is the best choice for the singleton. more a matter of preference than anything i suppose. at least i cant think of a better reason to argue for composition.no idea what you meanya; some of these posts from you are a little hard to understand, julian. -nathan