Difference between #4 and #5 of
1:n relations sometimes require CDbCriteria.together

Changes

Title unchanged

1:n relations sometimes require CDbCriteria.together

Category unchanged

Tips

Yii version unchanged

Tags unchanged

CActiveDataProvider, cdbcriteria, together, cdbcriteria.together, 1:n, has_many, relations, active record

Content changed

[...]
People are in table `person` and phones in table `phone`. Each person can have zero, one or more phones. Phones can exist without being owned by anyone. So `phone` has a _non-identifying_ 1:n relation to `person`.

~~~
[sql]
CREATE TABLE person (
id INT NOT NULL PRIMARY KEY

 
);

CREATE TABLE phone (
[...]
CONSTRAINT fk_phone_person
FOREIGN KEY (person_id) REFERENCES person (id)
ON DELETE SET NULL

 
    
ON UPDATE RESTRICT
 
);
~~~


### The view
[...]
15 0
12 followers
Viewed: 51 988 times
Version: 1.1
Category: Tips
Written by: fsb
Last updated by: fsb
Created on: Dec 1, 2011
Last updated: 10 years ago
Update Article

Revisions

View all history