M
M
Mikha Pankratov2016-09-13 13:04:23
Yii
Mikha Pankratov, 2016-09-13 13:04:23

How to pass additional data for item to ActiveDataProvider?

Good afternoon,
maybe someone knows how to pass additional parameters to the ActiveDataProvider.
I now receive an object that has an id, and I pull out x - id and use it in the request to pull the necessary information from the database, but I also have x which is different for each and I need also pass it to ActiveDataProvider / tell me how to do this?

//массив 
[
['id' => 1, 'x' => 111],
['id' => 2, 'x' => 222],
['id' => 3, 'x' => 333]
]

По id я забрал все из нужной мне таблицы к примеру User::find()->where('in', 'id', ArrayHelper::getColumns($масств, 'id'))
сунул все в dataProvider 
Но тут вопрос как мне передать еще и x в этот дата провайдер для каждого id свой

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2016-09-13
@slo_nik

Good afternoon.
Perhaps you meant it?

// тут можно кучу параметров передать
$query = Post::find()->where(['status' => 1])->andWhere()*****;

$provider = new ActiveDataProvider([
    'query' => $query
   // далее разбивка на страницы
  // сортировка
 // и так далее
]);

detail

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question