in the firm/company grid view i want to show the running projects count for each firm in a column.
how can i show the ‘taskCount’ column in the CGridView?
...
$criteria->with = array('projects'=>array(
'select'=>'(select count(*) from project p where p.id = t.id) As taskCount ', ));
$criteria->together = TRUE;
return new CActiveDataProvider('Firm', array(
'criteria'=>$criteria,
));
i can do it like this
'value'=> 'Project::model()->count("firm_id=".$data->id)',
but it fires separate sql query for each row.