Skip to content

Instantly share code, notes, and snippets.

@indrekots
Created October 11, 2013 09:27
Show Gist options
  • Save indrekots/6932038 to your computer and use it in GitHub Desktop.
Save indrekots/6932038 to your computer and use it in GitHub Desktop.
Defining a "belongs to" relation using Yii's Active Record
<?php
...
public function relations() {
return array(
'parentModel' => array(self::BELONGS_TO, 'ParentModel', 'parent_model_id')
);
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment