Re: DB_DataObject - problem with inheritance

From: Date: Sun, 28 Dec 2003 21:28:06 +0000
Subject: Re: DB_DataObject - problem with inheritance
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-9845@lists.php.net to get a copy of this message
mitchell perilstein wrote:
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: [...]
Sure, I just wasn't precise enough. Of course you can use the same method names as in DataObject in your derived class, you just have to make sure they behave correctly. However, if you've already had an insert() method (or whatever else) in your base class before, that did something completely different(tm), and then you extend from DataObject - that's where things are gonna break, naturally. CU Markus

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