How To Create A Stat Relation With Yii 2 ?

Classical example:

group hasMany user

user hasOne group

i’d like to create group.user_count as a stat relation using COUNT(user.id)

What’s the new way?

Looks like it’s not implemented yet https://github.com/yiisoft/yii2/issues/2179

Found a wiki, now I’ll study if this is my case

http://www.yiiframework.com/wiki/621/filter-sort-by-calculated-related-fields-in-gridview-yii-2-0/