获取评论Crud的文章标题

| 我创建了一个文章和评论模型,并且都具有CRUD。它的作品完美。我现在需要在Comment Crud中显示article.title字段,而不是comment.articleid。我怎样才能做到这一点? 这就是我卡住的地方。我不知道下一步该怎么做,或者这是正确的:
public function relations()
{
    // NOTE: you may need to adjust the relation name and the related
    // class name for the relations automatically generated below.
    return array(
        \'article\'=>array(self::BELONGS_TO, \'Article\', \'articleid\')
    );
}
编辑: 这是我的代码admin.php视图文件:
<?php $this->widget(\'zii.widgets.grid.CGridView\', array(
    \'id\'=>\'comment-grid\',
    \'dataProvider\'=>$model->search(),
    \'filter\'=>$model,
    \'columns\'=>array(
        \'commentid\',
        \'articleid\',
        \'content\',
        \'author\',
        \'email\',
        array(
            \'class\'=>\'CButtonColumn\',
        ),
    ),
)); ?>
谢谢。     
已邀请:
        对于columns数组,将是这样的:
\'columns\'=>array(
        \'commentid\',
        array(
            \'name\'=>\'title\',
            \'value\'=>\'$data->article->title\',
            \'type\'=>\'text\'
        ),
        \'content\',
        \'author\',
        \'email\',
        array(
            \'class\'=>\'CButtonColumn\',
        ),
    ),
    
        您需要在Comment模型中创建此关系,并且它将通过基于articleid加入文章来获取所有匹配的记录 然后,您可以通过替换要显示的值来修改视图。     
        您必须使用comment-> article-> title而不是comment-> articleid     

要回复问题请先登录注册