Application design (feeback needed)

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
nielsene
DevNet Resident
Posts: 1834
Joined: Fri Aug 16, 2002 8:57 am
Location: Watertown, MA

Post by nielsene »

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
Post Reply