Difference between #15 and #16 of
Drills : Search by a HAS_MANY relation in Yii 1.1

Revision #16 has been created by softark on Dec 12, 2014, 5:38:11 AM with the memo:

small change
« previous (#15) next (#17) »

Changes

Title unchanged

Drills : Search by a HAS_MANY relation in Yii 1.1

Category unchanged

Tutorials

Yii version unchanged

Tags unchanged

has_many, search, CActiveRecord

Content changed

Sometimes we get lost trying to search by a HAS_MANY relation using CActiveRecord or CActiveDataProvider in **Yii 1.1**. This article is a series of drills that try to describe the practical techniques of searching by a HAS_MANY relation. > Note: Note that this article is Yii 1.1 specific. > For **Yii 2**, please read the new article - [Drills : Search by a HAS_MANY relation in Yii 2.0](http://www.yiiframework.com/wiki/780/drills-search-by-a-has_many-relation-in-yii-2-0/) that is completelrewritten entirely for Yii 2.0.

## Relation
Two entities are sometimes connected with a relation of **1:N**. Or we may say that 1:N is the only possible relation between 2 entities as long as we are in the RDB world. **1:1** relation is just a particular kind of 1:N where N is always assumed to be 1 at the maximum. And **N:N** relation can be considered as a combination of two 1:N relations.

Yii supports this 1:N relation in CActiveRecord as **BELONGS_TO** and **HAS_MANY** relations. 1:N relation seen from the side of N is BELONG_TO, and from the side of 1 it is HAS_MANY.
[...]
22 0
27 followers
Viewed: 76 362 times
Version: 1.1
Category: Tutorials
Written by: softark
Last updated by: softark
Created on: Dec 6, 2012
Last updated: 5 years ago
Update Article

Revisions

View all history