Re: Using the DB methods in another class

From: Date: Sun, 24 Feb 2002 17:03:45 +0000
Subject: Re: Using the DB methods in another class
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-895@lists.php.net to get a copy of this message
On Wednesday 13 February 2002 14:02, Ron Dyck wrote: > What is the best way to use methods from the DB class in another > class. When I used phplib I did the following: > > function start_db() { > $name = $this->database_class; > $this->db = new $name; > > But I don't feel this is the best way to do it with PEAR's DB > because the class is not normally instantiated using 'new'. in Tree/OptionsDB.php there is an implementation that in my eyes could be used to provide some kind of PEAR-Common class, which does the DB-connecting stuff in a PEAR class, as Auth does it if we made this class somehow PEAR-common (i.e. putting it in PEAR/Common.php or ???) then we could provide an easy start for implementing classes, that use a DB-connection, and this can not only be used for creating classes inside PEAR, but also by applications using PEAR Martin, i would also be interested in your opinion about it, since Auth also uses the PEAR-DB -- Wolfram ... translating template system ... http://wolfram.kriesing.de/SimpleTemplate

« previous php.pear.general (#895) next »