RE: [PEAR] making DataObject::get() call other methods

From: Date: Wed, 14 Dec 2005 04:02:36 +0000
Subject: RE: [PEAR] making DataObject::get() call other methods
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22247@lists.php.net to get a copy of this message
hi Jeff, > Is there a way to have the get() method call other methods to do some > parsing before it returns an object? Yes, make a class that derives from DB_DataObject and override the get() method, like this: function get($k = null, $v = null) { // call DB_DataObject get method to fetch the data $success = parent::get($k, $v); if ($success) { // do your special stuff } return $success; } You'll also need to change the "extends" and "extends_location" properties in your DBDO ini file, or wherever you setup the configuration. eg extends_location = DB_DataObject_Ex.php extends = DB_DataObject_Ex hth, Rob

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