In my model (let’s say Model A) I have a field corresponding to the id of another model (Model . In a CGridView composed of Model A items, instead of showing the id of Model B, I want to show another field of that model instance.
Here’s how I am showing my CGridView;
$dataProvider = new CArrayDataProvider('Model A');
$dataProvider->setData($model_A_Data); // $model_A_data is an array of Model A Objects
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'data-id',
'dataProvider'=>$dataProvider, //$objects->search(),
'columns'=>array(
array('header'=>'Model A Id', 'name'=>'id'),
array('header'=>'Name', 'name'=>'name'),
array('header'=>'Date', 'name'=>'date_created'),
array('header'=>'Model B Id', 'name'=>'model_b_id'), // *HERE SHOW ANOTHER FIELD OF MODEL B*
),
));
How can I change that column in order to show another field of model B clasS?
Thanks