Re: New PDO-based DBAL/ORM for PEAR2
| From: | Helgi Þormar Þorbjörnsson | Date: | Wed, 21 Nov 2007 08:44:08 +0000 |
| Subject: | Re: New PDO-based DBAL/ORM for PEAR2 | ||
| References: | 1 2 3 4 5 6 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-48543@lists.php.net to get a copy of this message | ||
On 11/21/07, Bertrand Mansion <golgote@mamasam.com> wrote:
>
>
> Le 21 nov. 07 à 02:53, Michael J. I. Jackson a écrit :
>
> >
> > On Nov 20, 2007, at 1:29 PM, Bertrand Mansion wrote:
> >
> >>
> >> Le 20 nov. 07 à 18:51, Michael J. I. Jackson a écrit :
> >>
> >>> On Nov 20, 2007, at 6:36 AM, Bertrand Mansion wrote:
> >>>
> >>>> and remove the singleton method.
> >>>
> >>> Why?
> >>
> >> Singleton what ? Doesn't mean anything for me.
> >
> > Singleton doesn't create a new database instance. Instead, if you
> > are connecting with the same DSN, username, and password, it will
> > return the same database connection that has already been
> > established with that combination. It's nice so that you don't
> > create multiple database connections with the exact same connection
> > parameters.
>
> I use named connections for that and only one method : getConnection
> ($id = '__default__)
> IMO, no need for a meaningless singleton method. It's appealing at
> first to use such method names in your code but it just confuse users
> in the end because they have no idea what a singleton is or what will
> be returned.
I agree with Bertrand on this, getConneciton this way is the way to go.
- Helgi