做个笔记,代码如下:
class ArticleViewModel extends ViewModel {
//文章表视图模型
public $viewFields = array(
'article'=>array('id', 'title', 'cid', 'post_time', 'visitors'),
'category'=>array('cname', '_on'=>'article.cid=category.id', '_type'=>'LEFT'), //文章分类表,在关联模型里面属于BELONGS_TO
'pl'=>array('pl1', 'pl2', '_on'=>'article.id=pl.aid', '_type'=>'LEFT'), //评论表,在关联模型里面属于HAS_ONE
'tz'=>array('id'=>'tz_id', '_on'=>'article.id=tz.aid', '_type'=>'LEFT') //投资表,在关联模型里面属于HAS_ONE
);
}
实现多表查询


