/**
  * @param array|null $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MarketOrder::find()->joinWith(['staStation', 'invTypes']);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!$this->load($params) && !$this->validate()) {
         return $dataProvider;
     }
     $dataProvider->getSort()->attributes['stationName'] = ['asc' => ['staStations.stationName' => SORT_ASC], 'desc' => ['staStations.stationName' => SORT_DESC]];
     $dataProvider->getSort()->attributes['typeName'] = ['asc' => ['invTypes.typeName' => SORT_ASC], 'desc' => ['invTypes.typeName' => SORT_DESC]];
     $query->andFilterWhere(['stationID' => $this->stationID])->andFilterWhere(['like', 'stationName', $this->getAttribute('stationName')])->andFilterWhere(['like', 'typeName', $this->getAttribute('typeName')])->andFilterWhere(['orderState' => $this->orderState])->andFilterWhere(['characterID' => $this->characterID]);
     return $dataProvider;
 }
Exemplo n.º 2
0
 /**
  * @return static
  */
 public function getOrders()
 {
     return MarketOrder::find()->where(['characterID' => $this->characterID, 'stationID' => $this->stationID, 'typeID' => $this->typeID, 'orderState' => MarketOrder::ORDER_STATE_OPEN])->all();
 }