Leandro Panegassi Thu Apr 23 12:44:03 -0400 2015

Subject: Active Records + Composite + Entity + DB Join + PHP

I am with a doubt architecture that believe it is very basic, do you guys could help me?

My scenario is as follows:


Table: Participant
Fields: id primary key, name varchar (60), email varchar (110)

Table: Result
Fields: id primary key, participant (id participant), int points


class ParticipantEntity {
    private $ id;
    private $ name;
    private $ email;

class ResultEntity {
    private $ id;
    private $ participant;
    private $ points;


class ResultModel {
    public function findAll () {
        return $ this-> db-> get_where ('result', array ());

So far so good, I believe this course. I have a table result that has a foreign key participant.

Only to call my model results, as I do for my popular result entity, and the participant attribute is a participant entitidade class? Is there a pattern to it?

I believe the question should be the common good, as I populo an entity when I have queries with joins + composite pattern.

Thank you.