Skip to content

Instantly share code, notes, and snippets.

@muya
Created May 27, 2013 06:06
Show Gist options
  • Save muya/5655411 to your computer and use it in GitHub Desktop.
Save muya/5655411 to your computer and use it in GitHub Desktop.
Snippet of a Yii model's relations function
/**
* @return array relational rules.
*/
public function relations()
{
// NOTE: you may need to adjust the relation name and the related
// class name for the relations automatically generated below.
return array(
'studentProfiles' => array(self::HAS_MANY, 'StudentProfiles', 'userID'),
'userGroupMappings' => array(self::HAS_MANY, 'UserGroupMappings', 'userID'),
'status_' => array(self::BELONGS_TO, 'EntityStates', 'status')
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment