Re: extending pear db

From: Date: Mon, 27 Oct 2003 11:59:21 +0000
Subject: Re: extending pear db
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8610@lists.php.net to get a copy of this message
Ámon Tamás wrote:
Hi! I like to extend pear db. I made something like this:
     class a_db extends      DB
       {
               function a_db(){
                       //itt valami
               }
               function foo(){
               }
       }
and after call this: $db = &a_db::Connect($_config['dsn']); But when I try to call $db->foo(); I get the message: Call to undefined function: foo(); I think this is because the $db is a DB_mysql object. How van I solve this problem? db:::connect() probably returns an instance of PEAR::DB and not of your class.
Don't know the most elegant way to overcome this, but I think you should just instantiate your class directly. HTH Jeroen

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