Here’s how to create an ActiveDataProvider in Yii2 and get a count of records: [php] use yii\data\ActiveDataProvider; $participantProvider = new ActiveDataProvider([ ‘query’ => Participant::find()->where([‘meeting_id’=>$id]), ]); echo $participantProvider->getCount(); [/php]