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?
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 {
}
class Auction extends ActiveRecord\Model {
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