对self::STAT的一点不成熟的看法

文档中,对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.

这个貌似是可以支持的,在array(self::STAT, xxx, xxx后面还可以加array(select="统计字段") 比如count(*)等

对,你可以设置select选项实现其它统计。