S
S
Snewer2017-06-22 12:40:05
Yii
Snewer, 2017-06-22 12:40:05

How to fetch source data in DataProvider using Sphinx?

Hello!
I'm making a fetch request to Sphinx. In response, I get the id and the number of entries. Now we need to display the original records in the GridView through the ActiveDataProvider.
How is it implemented?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Dmitry, 2017-06-22
@slo_nik

Good afternoon.
So there are examples in the documentation .
Topic on toster.ru
Or something doesn't work for you?
If so, please show your code.

M
Maxim Timofeev, 2017-06-22
@webinar

$ids = [1,2,4,768,8797]; // полученные id от сфинкса или еще откуда либо

$dataProvider =  new ActiveDataProvider([
    'query'=>SomeModel::find()->andWhere(['id'=>$ids]),
]);

echo \yii\grid\GridView::widget([
     'dataProvider' => $dataProvider,
 ]);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question