Hi, I have a problem understanding relations.
I have these tables:
Modules
- name (pk)
- status_id (fk references status(id))
Status
- id (pk)
- name
So in Module I declare relations:
public function relations()
{
return array(
'status'=>array( self::HAS_ONE, 'Status', 'status_id' ),
);
}
However this doesn’t work.
I have a problem understanding if the constants apply to the relationed model or the current model, example Module HAS_ONE Status or if should be Status BELONGS_TO a Module.
Note that BELONGS_TO does work, so maybe I am answering myself but I would like some advice on how to better understand relations, because in the YII Guide examples, a user HAS_ONE Profile, so isn’t it the same as user HAS_ONE status?
Thanks a lot.