How in yii 1.1.7 using CDbCriteria and CActiveDataProvider to make subquery for calculaion number of rows in related table in 1 request ?
In CodeIgniter I wrote like :
$CategoryFactory = ORM::factory('category');
$CategoryFactory->select( DB::expr( ' ( select count(*) from `tour` where `tour`.`category_id` = `category`.`id` ) as related_tours_count ' ) );
...
$category_result= $CategoryFactory->find_all();
Is there is similar way in yii 1.1.7 ?