Re: DB_DataObject CleanAttributes()
| From: | Alan Knowles | Date: | Fri, 23 May 2003 14:51:51 +0000 |
| Subject: | Re: DB_DataObject CleanAttributes() | ||
| References: | 1 2 | Groups: | php.pear.general php.pear.general |
| Request: | Send a blank email to pear-general+get-5572@lists.php.net to get a copy of this message | ||
technically
$class = get_class($dataobject);
$do2 = new $class;
$datobject->setFrom($da2->toArray());
should work...
The Php_kid wrote:
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.