255], ]; } public function search($params) { $creditHistoryManager = new CreditHistoryManager(); $optionsSearch = $creditHistoryManager->getDefaultOptionsSearch() ; $query = CreditHistory::find() ->with($optionsSearch['with']) ->innerJoinWith($optionsSearch['join_with'], true) ->where(['credit_history.id_producer' => GlobalParam::getCurrentProducerId()]) ->orderBy('id DESC') ; $dataProvider = new ActiveDataProvider([ 'query' => $query, 'sort' => false, 'pagination' => [ 'pageSize' => 20, ], ]); $this->load($params); if (!$this->validate()) { return $dataProvider; } if(isset($this->id_user) && is_numeric($this->id_user)) { $query->andWhere([ 'credit_history.id_user' => $this->id_user ]) ; } return $dataProvider; } }