How to get the contents of another table in Yii?

0

I would like instead of the ID, display the name of the employee.

<?php
$this->widget('zii.widgets.grid.CGridView', array(
    'id'=>'documento-grid',
    'dataProvider'=>$model->search(),
    'columns'=>array(
        'id_documento',
        'nome_documento',
            array(
            'name'=>'Download',
            'header'=>'Download',
            'type'=>'raw',
            'value'=>'CHtml::link($data->path_documento, array("documento/download","id"=>$data->id_documento))',
            //'htmlOptions'=>array('width'=>'10%'),
        ),
        'id_documento_funcionario',
        array(
            'class'=>'CButtonColumn',
            'template'=>'{view}{delete}',
        ),
    ),
)); 
?>
    
asked by anonymous 29.10.2014 / 20:53

1 answer

1

Hello,

You can do this as follows:

link

'columns' => array(
    'funcionario.nome',
    // outras colunas...
),
    
05.12.2014 / 15:51