Created
September 5, 2012 12:12
-
-
Save pronskiy/3635739 to your computer and use it in GitHub Desktop.
CActiveRecord classic relation adding
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class User extends CActiveRecord | |
{ | |
… | |
public function relations() | |
{ | |
return array( | |
'posts'=>array(self::HAS_MANY, 'Post', 'author_id'), | |
'profile'=>array(self::HAS_ONE, 'Profile', 'owner_id'), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment