karataserkan/yii2-multi-dataprovider

Generates multiple dataprovider result

1.0.0 2016-10-06 06:17 UTC

This package is not auto-updated.

Last update: 2024-04-27 17:03:56 UTC


README

gets data from multiple dataproviders

Latest Stable Version Total Downloads Monthly Downloads License

Installation

The preferred way to install this extension is through composer.

Either run

$ composer require karataserkan/yii2-multi-dataprovider

or add

"karataserkan/yii2-multi-dataprovider": "*"

to the require section of your composer.json file.

Usage

use karataserkan\yii2MultiDataProvider\MultiDataProvider;

$data1 = new ActiveDataProvider([
    'query' => $query,
]);

$data2 = new ArrayDataProvider([
    'allModels' => [...],
]);

$dataProvider = new MultiDataProvider([
    'dataProviders' => [$data1,$data2],
]);
$dataProvider = new MultiDataProvider([
    'dataProviders' => [$data1,$data2],
    'modelCallback' => function ($model) {
        return new YourModel(['data' => $model]);
    },
]);

Contributing

  1. Fork it ( https://github.com/karataserkan/yii2-multi-dataprovider/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Credits