\app\models\base\Comments::find()->andWhere(['need_moderation'=>0]) ->leftJoin(["p"=>\app\models\base\OldNews::tableName()],'p.comment_pull_id = comments.comment_pull_id') ->andWhere(['is not','p.id',new \yii\db\Expression('NULL')]) ->orderBy(['id'=>SORT_DESC]), "pagination" =>[ "pageSize"=>3 ], ] ); ?>

Комментарии в эфире

cache->getOrSet("header-comments",function () use ($newsDataProvider){ $sql = $newsDataProvider->query->createCommand()->getRawSql(); return \yii\widgets\ListView::widget([ "dataProvider" => $newsDataProvider, 'options' => [ 'tag' => "ul", 'class' => 'header-comments__list', 'id' => false, ], "itemOptions"=>[ "tag"=>false ], "itemView" => "_header_comments_item", "layout" => "{items}" ]); },1); ?>