Elgin Rogers Fri Mar 23 07:30:08 -0400 2012

Subject: Association vs Joins question

I’m using phpactiverecord with my project. I’m trying to make use of associations and joins.

First, should I setup associations in both directions on the associated models?

Example:

class User extends ActiveRecord\Model {

static $has_many = 'auctions';

}

class Auction extends ActiveRecord\Model {

static $belongs_to = 'user';
}

Or should I just setup the parent (User) model association?

In querying the user table to bring in a user’s auctions, should I do it using association or “join” in phpactiverecord? What’s the difference? Is one better than the other?

Thanks.

Slider