Relations function in AR Model, many to one relationship
问题 So here's the scenario: I have two table, Issue & Project. A Project can have many Issue and an Issue can exactly one project. Since Issue is many to one, do you have to define it? Cause I know in Project Model I have: public function relations() { return array( 'issues' => array(self::HAS_MANY, 'Issue', 'project_id'), 'users' => array(self::MANY_MANY, 'User', 'tbl_project_user_assignment(project_id, user_id)'), ); } For Issue Model I have nothing but foreign keys: public function relations()