Hi guys! In my app limit not worked correctly. My query:
$products = Product::find()
->joinWith('categories')
->joinWith('review')
->joinWith('vendor')
->joinWith('productProperties')
->filterWhere(['in', 'product_category_property_id', $filter])
->andFilterWhere(['product_category_link.category_id' => $category])
->andFilterWhere(['between', 'price', $cost_from, $cost_to])
->andFilterWhere(['hit' => $on_top])
->andFilterWhere(['in', 'brand_id', $get_brands]);
$count = clone $products;
$pagination = new Pagination([
'defaultPageSize' => 12,
'totalCount' => $count->count(),
]);
$models = $products->orderBy(['created_at' => SORT_DESC])
->offset($pagination->offset)
->limit($pagination->limit)
->all();
If I try without pagination with limit problem is similar too. But without limit everthing ok. If I remove all joins limit works correctly