RE: [PEAR] DB_DataObject - problem with inheritance
| From: | Torsten Roehr | Date: | Mon, 29 Dec 2003 09:46:37 +0000 |
| Subject: | RE: [PEAR] DB_DataObject - problem with inheritance | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9862@lists.php.net to get a copy of this message | ||
Dear Markus and Mitchell,
thanks for your quick and useful advice. Your idea for my "Super class"
problem should work very well.
Thanks and greets,
Torsten
> -----Original Message-----
> From: Markus Wolff [mailto:wolff@21st.de]
> Sent: Sunday, December 28, 2003 10:28 PM
> To: mitch@enetis.net; pear-general@lists.php.net
> Subject: Re: [PEAR] DB_DataObject - problem with inheritance
>
>
> 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
>
> --
> PEAR General Mailing List (http://pear.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>