예제 #1
0
 public function run()
 {
     $categories = Category::find()->joinWith(['posts'])->addSelect(['category.*', 'count(post.id) as postCount'])->groupBy('category.id')->all();
     echo $this->renderCategories($categories, null, 0);
 }