Ejemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params, $currency, $transaction, $location)
 {
     $query = Exchange::find()->where(['currency' => $currency])->andWhere(['transaction' => $transaction])->andWhere(['location_id' => $location]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'totalCount' => 100, 'pagination' => ['defaultPageSize' => 100, 'pageSizeLimit' => [1, 100]]]);
     $this->load($params);
     if (!$this->validate()) {
         $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['create_time' => $this->create_time]);
     return $dataProvider;
 }