Yii: Create a personalized relationship between two tables
To make a custom relationship between two tables in a model, it is possible to add an additional option in the relation in which one indicates which foreign key should be used with which field. public function relations () { return array ( ‘NameRelation’ – array ( self::HAS_ONE, ‘otherTable, ”, ‘on”fk_otherTabletable.fk_otherTable ‘ otherTable.id’ ), ); … Read more