Answer the question
In order to leave comments, you need to log in
Sphinx and Yii2, how to set limit correctly?
Please tell me I have the following code:
public function search() {
$this->load($this->searchParams);
$query = new Query();
$items = $query->from('news')
->match($this->query)
->orderBy(['date_added' => SORT_DESC])
->all();
$items = array_column($items,'id');
$query = News::find()
->where(['in', 'id', $items]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'sort' => false,
'pagination' => [
'pageSize' => 15
]
]);
return $dataProvider;
}
Answer the question
In order to leave comments, you need to log in
The fact is that in the view I work with the news object and use its methods, what should I do?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question