Conditional Field Like Mysql

Hi. I have this model with a relation and i’m displaying it with a cgridview.

Inside my cdbcriteria i have this condition:


IF(DATE_FORMAT(rap.month, '%m') = DATE_FORMAT(t.installation_date, '%m'), 1, 0) AS done

Mysql generates the "done" field with the value of 1 or 0.

Now, how can i display this value in the cgridview?

I’ve never done this in Yii but does this work?




$this->widget('zii.widgets.grid.CGridView', array(

// ...

    'columns' => array(

        array(

            'header' => 'Done',

            'value' => '$data->done',

        ),

    ),

));



Ok, i found the solution. Simply using ‘done’ as a column will work, but you will need to add the ‘done’ property to the model (right after the class starts, you add ‘public $fatto;’ )