Skip to content

Instantly share code, notes, and snippets.

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