Yii2 Multi DataProvider
add
"karataserkan/yii2-multi-dataprovider": "*"
to the require
section of your composer.json
file.
use karataserkan\yii2MultiDataProvider\MultiDataProvider;
$data1 = new ActiveDataProvider([
'query' => $query,
]);
$data2 = new ArrayDataProvider([
'allModels' => [...],
]);
$dataProvider = new MultiDataProvider([
'dataProviders' => [$data1,$data2],
]);
Written by karataserkan
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Yii2
Authors
karataserkan
582
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#