RE: [PEAR-DEV] singleton mathod name (do pear packages create their own seperate DB connections?)

From: Date: Sun, 27 Apr 2003 09:47:15 +0000
Subject: RE: [PEAR-DEV] singleton mathod name (do pear packages create their own seperate DB connections?)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-15593@lists.php.net to get a copy of this message
> From: Martin Jansen [mailto:mj@php.net] > Sent: Thursday, April 24, 2003 11:54 AM > > On Wed Apr 23, 2003 at 11:5814AM +0200, Wolfram Kriesing wrote: > > Lukas Smith wrote: > > >2) make singleton optional: MDB::singleton($dsn, $options) > > > > am i right that PEAR defines the method, which gets you a singleton > > instance is called "singleton"? > > I am just asking to get a clear definition, since we are trying to > > make some common method names unique here, right? > > If there is no definition yet, i might suggest "getInstance", but that > > is just a personal preference. > > I guess we should stick to singleton(), as this is used at a lot of > places on PEAR already. If it comes to the Factory pattern, the method > name should be factory(). There we go: I have added MDB::singleton() into CVS. Just drop in the new MDB.php. The thing I am not yet sure about is the handling of options. When I find a matching instance with the same DSN I first set the passed $options array: MDB::setOptions($_MDB_databases[$i], $options); return $_MDB_databases[$i]; what do people think? Regards, Lukas

« previous php.pear.dev (#15593) next »