Hi,
I have this tables:
When I get the Product with its relation from product_translation I want it according to the user selected language, so on the relation I have:
The problem is that the translation in the user language might not exist, so get it in the default language.
How can I do this?
I have this tables:
product ( id, ... ); product_translation ( product_id, lang_code, name, ... );
When I get the Product with its relation from product_translation I want it according to the user selected language, so on the relation I have:
'productTranslation' => array(self::HAS_ONE, 'ProductTranslation', 'product_id', 'condition'=>Yii::app()->db->quoteColumnName('productTranslation.lang_code')."='".Yii::app()->user->language."'" ),
The problem is that the translation in the user language might not exist, so get it in the default language.
How can I do this?