[CDBI] re-casting cdbi classes?

Perrin Harkins perrin at elem.com
Wed Mar 22 20:13:54 GMT 2006

On Sat, 2006-03-18 at 23:35 +0100, Ben Lavender wrote:
> alternately, I could
> hit the database once to determine the event type and then load it as
> a specific kind of event

That's what I did, and it worked fine.  I made a base class which checks
a type column when you call retrieve and loads an object of the right
class.  I suspect re-blessing will get you into a lot of trouble.

> Though I see that I can essentially get the benefits of all of these
> classes by just asking the object if it usesMiles or usesDates all
> over the place while shoving all the methods into one package, that's
> not the most maintanable way to code, usually.

It's still probably better than a re-blessing scheme.

- Perrin

More information about the ClassDBI mailing list