$top=Watch::find()
->select(['fl_serial.*,fl_watch.*,COUNT(fl_watch.active=1) AS total_count'])
->joinWith('serial','fl_watch.id_serial=serial.id')
->groupBy('fl_watch.id_serial')
->orderBy(['total_count'=>SORT_DESC])
->limit(10)
->all();
foreach($top as $post){
$posts[]=$post->total_count;}