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]

Support this site, share this page:Tweet about this on TwitterShare on RedditShare on LinkedInShare on FacebookEmail this to someone
  • Fabrício Nicoletti Hedlund

    Straight forward! =)