getDefaultOptionsSearch(); $query = ProductPrice::find() ->with($optionsSearch['with']) ->innerJoinWith($optionsSearch['join_with'], true) ->where(['product.id_producer' => GlobalParam::getCurrentProducerId()]) ->orderBy('product_price.price ASC'); $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => false, 'pagination' => [ 'pageSize' => 1000, ], ]); $this->load($params); if (!$this->validate()) { return $dataProvider; } if (isset($params['id_product'])) { $query->andWhere(['product.id' => (int)$params['id_product']]); } return $dataProvider; } }