Special Data Attribute Syntax In Cactivedataprovider Vs Csqldataprovider

With a cActiveDataProvider, I’m able to use ‘value’=>’$data->nameOfTheColumn’ in the grid view, but CSqlDataProvider is requiring me to use it like this: ‘value’=>’$data[“issueCount”]’ (like an array).

Here’s an example:

In Controller:

public function actionIndex()


		$sql="SELECT site_id, COUNT(*) as issueCount FROM issues2 GROUP BY site_id ORDER BY openCount DESC";

		$dataProvider=new CSqlDataProvider($sql, array(









In View:

$this->widget('bootstrap.widgets.TbGridView', array(







            'htmlOptions' => array('style' => 'width: 50px'),

            'header'=>'Total Issues',




The different syntax might confuse people. Why does it need to be different? Maybe we can make CSqlDataProvider treat it like an object?