Re: DB_DataObject - problem with inheritance

From: Date: Sat, 27 Dec 2003 13:35:59 +0000
Subject: Re: DB_DataObject - problem with inheritance
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9843@lists.php.net to get a copy of this message
Markus Wolff wrote:
You must be careful with this, though: You can't use properties in your base class that are already being used by DataObject. You can't use the same method names, either.
I beg to differ on the method caution. I find it very useful to override DataObject methods in the extension class. For example, some of my stored objects have comment fields, so I can catch that by overriding the insert method in my extension, with neither my child objects nor DataObject knowing about it: function insert() { $this->storeComments();
   return parent::insert();          // parent here refers to DB_DataObject
} Regards, - mitch

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