Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juban/4ec246986c001f644c6d85d73154c2d4 to your computer and use it in GitHub Desktop.
Save juban/4ec246986c001f644c6d85d73154c2d4 to your computer and use it in GitHub Desktop.
Yii2 - Create an ActiveDataProvider from a HasMany model relation
<?php
$applicationsDataProvider = new \yii\data\ActiveDataProvider([
'query' => $model->getRelation('relationName'),
'pagination' => [
'pageParam' => 'apps_page'
]
]);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment