Re: Extending a class with a static constructur (like PEAR::DB)
| From: | weston at leary dot csoft dot net | Date: | Fri, 10 Mar 2006 00:09:05 +0000 |
| Subject: | Re: Extending a class with a static constructur (like PEAR::DB) | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231744@lists.php.net to get a copy of this message | ||
> > So... I'm trying to extend PEAR::DB. It'd be great to keep everything it offers
> > and just add a few more perhaps unconventional functions.
> >
> > $dte =
> > DBToyExt::connect("mysql://weston_tssa:******@localhost/weston_tssa");
> >
>
> DB::connect() is actually a factory call. So what is returned is an
> instance of (in your case) a DB_mysql object.
Ahhh! I'd kept thinking what connect() returned was a db object, but it does look like
it returns varying objects depending on which database you're using.
Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods would
be inhereted by any object?
Thanks,
Weston