文档中,对self::STAT关联说得很少,假设在Post模型类的relations方法中定义如下关联:
‘post_’=>array(self::STAT,'comment','postId'),那么执行查询语句后,访问post_,将返回统计数。其意义大概等效于select count(*) from post,comment where post.id=comment.postId group by comment.postId.
我想说明的是:这个功能貌似还不够强大,不知道强哥能不能把它改造下,
是其能支持select sum(…) from comment group by postId.