我有一个模型Reporter
。
public function relations() {
return array(
'video' => array(self::HAS_MANY, 'Video', 'reporter_id'),
);
}
我有一个mysql查询Reporter->search()
方法:
SELECT t.*, COUNT(t1.id) AS 'reports'
FROM reporter AS t
LEFT JOIN video AS t1 ON t.id = t1.reporter_id
GROUP BY t.id
ORDER BY t.name
怎么写成CDbCriteria
to use with CActiveDataProvider
?