ActiveRecord dilemma

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

Post Reply
mu-ziq
Forum Newbie
Posts: 11
Joined: Fri Jul 08, 2005 9:42 pm

ActiveRecord dilemma

Post by mu-ziq »

Hey guys. I've got a question.

Say I have a blog "post/comment" type of setup.

I have created two tables, Post and Comment and then implemented each with classes using ActiveRecord pattern, which seemed to work great up until I started adding new features.

Unfortunately some of the calls to the Comment object (such as to edit its content) will require, in addition to retrieval of data from the Comment table('Comment message'), retrieval of data from the Post table ('Post status' to see if the Post is closed for new comments and editing is no longer allowed) implying a table join query.

Since now I am querying multiple tables with a single object, ActiveRecord no longer applies.

Is there a name for a pattern that fits this setup that I could google around for? I am specifically interested in those that relate multiple tables with a join query.

Thanks a lot.
User avatar
Ambush Commander
DevNet Master
Posts: 3698
Joined: Mon Oct 25, 2004 9:29 pm
Location: New Jersey, US

Post by Ambush Commander »

Mapper.
Post Reply