Yii BELONGS_TO Relations using a non-primary key

Yii – BELONGS_TO, Relations using a non-primary key

Define relationship in model

'xxx' => array(self::BELONGS_TO, 'YYYYY', '', 'on' => 't.sno=xxx.sno'),

Comments: the red party (‘YYYYY’,, ‘on’ =>) is the keypoint

Leave a Reply