Does GII handle composite primary keys in V2?
Does GII handle composite primary keys in V2?
yes
I have two tables:
category
category_desc
The category_desc table has a composite primary key: category_id, language_id.
I generated models and in my Category class I find:
public function getCategoryDesc()
{
return $this->hasOne(CategoryDesc::className(), ['category_id' => 'id']);
}
No mention of language_id (although there is a HAS_MANY method getLanguages() >> unnecessary).
I normally store language ID in session: Yii::app()->session[‘language_id’] (Yii 1)
How should the above code be modified to return the correct category_desc record according the language_id in session?