Hi,
I have this issue where I need to join two tables that both have a dateAdded field and sort them by date. Below is my code.
$criteria = new CDbCriteria();
$criteria->select='*';
$criteria->join= 'left join product_subs on t.productCode = product_subs.productCode';
$criteria->order='t.dateAdded desc, product_subs.dateAdded desc';
$products = self::model()->findAll( $criteria );
Now this works fine, only problem is when accessing a productsubs relation I have in product they are obviously not sorted by date. It appears to me I cannot use models for this particular query. Can anyone point me in how I can do this with yii or if I have to do a manual query for this functionality. ( need the left join because some products do not have product subs ).