Skip to content

Instantly share code, notes, and snippets.

@pronskiy
Created September 5, 2012 12:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pronskiy/3635739 to your computer and use it in GitHub Desktop.
Save pronskiy/3635739 to your computer and use it in GitHub Desktop.
CActiveRecord classic relation adding
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