DB_DataObject CleanAttributes()
| From: | ThE PhP_KiD | Date: | Thu, 22 May 2003 19:02:17 +0000 |
| Subject: | DB_DataObject CleanAttributes() | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-5556@lists.php.net to get a copy of this message | ||
Hi, DataObject users.
I'm looking for a method for clean all my
DataObject database fields, without interfere
with DataObjects parent class.
At the momment, I'm using this on my extended
DataObject classes:
function CleanAttributes() {
$attributes = array_keys(get_object_vars($this));
foreach($attributes as $val) {
// next is in order to not interfere with
// dataobjects internal working:
if(substr($val,0,1)=="_") {
continue;
}
$this->$val=NULL;
}
}
There is simpler way to do it ?
This function could broken DataObjects internal integrity ?
Can I put this function on parent DataObjects class in order
to avoid to put it in each extended DataObject class?
Regards,
mac
--
...ThE PhP_KiD.