Re: [PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-10 Thread Andreas Korthaus
Chris wrote: You'll need to: $dbtoy = new DBToyExt(); $dbtoy->connect() $dbtoy->testext('testing'); But you cannot do: $dbtoy = new DBToyExt(); $dbtoy->connect() $dbtoy->testext('testing'); $result = $dbtoy->query('SELECT...'); //[...] You have to do something like this: $dbtoy =

Re: [PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-10 Thread Andreas Korthaus
[EMAIL PROTECTED] wrote: 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. correct Maybe I'd want to extend DB_common instead of DB_mysql, so that the methods would be inhereted by an

Re: [PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-09 Thread weston
> > 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:[EMAIL > > PROTECTED]/weston_tssa"); > > > > DB::connect() is actually a factory call. So

Re: [PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-09 Thread Chris
[EMAIL PROTECTED] wrote: Weston wrote: $dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL PROTECTED]/weston_tssa"); $dte->testext('testing'); $dte->testext($dte->moo); $dte->testext($dte->bar); >>> $dte will only have the return value of DBToyExt::connect() - it won't allow you to access

Re: [PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-09 Thread weston
Weston wrote: > > $dte = DBToyExt::connect("mysql://weston_tssa:[EMAIL > > PROTECTED]/weston_tssa"); > > > > $dte->testext('testing'); > > $dte->testext($dte->moo); > > $dte->testext($dte->bar); On Fri, Mar 10, 2006 at 10:43:02AM +1100, Chris wrote: > $dte will only have the return value of

Re: [PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-09 Thread Chris
[EMAIL PROTECTED] wrote: 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. Intuitively, it seemed like this approach might work: testext('testing'); $dte->testext($dte->moo); $dte->testext($dte->bar

[PHP] Extending a class with a static constructur (like PEAR::DB)

2006-03-09 Thread weston
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. Intuitively, it seemed like this approach might work: testext('testing'); $dte->testext($dte->moo); $dte->testext($dte->bar); ?> However, it does