I've gone a slightly different route with my "data objects". I start with a base class called "StoredObject". It knows how to post/retrieve from a database, as well as search given any known fields to return a list of primary keys.
The dervived objects simply establish a corespondence between class variables and table columns. It knows how to handle one-to-many and one-to-one joinings off the primary key. (Most of my data objects pull from 3-5 base tables.) In theory it is supposed to figure out the smallest number of queries/ updates needed using the dirty flags, but I've often turned that off for more simplicity.)
Source code (old and cruft... being redone in the near future.... I've moved away from artificial primary keys, which breaks the old insert v update behavour)
http://ballroom.mit.edu/compinabox/Publ ... t.inc.phps
http://ballroom.mit.edu/compinabox/Publ ... n.inc.phps
Application design (feeback needed)
Moderator: General Moderators