Difference between #2 and #3 of
Relations: BELONGS_TO versus HAS_ONE

Revision #3 has been created by Steve Friedl on Apr 26, 2011, 3:07:56 AM with the memo:

Minor wordsmithing
« previous (#2) next (#4) »


Title unchanged

Relations: BELONGS_TO versus HAS_ONE

Category unchanged


Yii version unchanged

Tags unchanged

relations, HAS_ONE, BELONGS_TO

Content changed

- id
- user_id REFERENCES User.id
- profile_info
**KEY POINT**: A `BELONGS_TO` relation says that a field in **this** model points to the primary key in **another** model; in this case,
_the current model owns the linking field_. **KEY POINT**: A `HAS_ONE` relation says that some **other** model has a linking field pointing to **this** model's primary key; in this case, _the related model owns the linking field_.

Let's put these in context (numbered for reference)

// Post model relations
56 0
Viewed: 149 448 times
Version: 1.1
Category: FAQs
Written by: Steve Friedl
Last updated by: Jorgee
Created on: Apr 26, 2011
Last updated: 6 years ago
Update Article


View all history