You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have two table for post and user. I want to show post count of user in users list gridview. In yii 1 I use this in model to define a relation for this purpose:
But i don't know how to implement this in Yii2 to get count of post in User:find():with('...') to show in gridview.
Anyone try this in yii2?
In other words, I want to show post count of each user in gridview. I have seasearchedloa lotf this question in internet but doesn't find a general answer. With Lazy loading this can be done, But performance comming down.
I have two table for post and user. I want to show post count of user in users list gridview. In yii 1 I use this in model to define a relation for this purpose:
'postCount' => array(self::STAT, 'Post', 'author',
'condition' => 'status = ' . Post::ACTIVE),
...
User:find...().with('postCount').....
But i don't know how to implement this in Yii2 to get count of post in User:find():with('...') to show in gridview.
Anyone try this in yii2?
In other words, I want to show post count of each user in gridview. I have seasearchedloa lotf this question in internet but doesn't find a general answer. With Lazy loading this can be done, But performance comming down.
http://stackoverflow.com/questions/26894987/get-count-in-relation-table-in-yii2-activerecord
www.yiiframework.com/forum/index.php/topic/59278-get-count-in-relation-table-in-yii2-activerecord/
The text was updated successfully, but these errors were encountered: