获取评论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\',
),
),
)); ?>
谢谢。
没有找到相关结果
已邀请:
3 个回复
降女陷费券
眠皇
久坡