Example #1
0
 /**
  * @param array $options
  * @param array $params
  * @return ActiveDataProvider
  */
 public function getFilterDataProvider($options = [], $params = [])
 {
     $query = static::find();
     $provider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 6]]);
     $hotelAlias = HotelRecord::tableName();
     if (!($this->load($params) && $this->validate())) {
         return $provider;
     }
     $query->children($this->children)->adults($this->adults)->hotel($this->hotel_id)->andFilterWhere(['=', $hotelAlias . '.country_id', $options['country_id']])->andFilterWhere(['=', $hotelAlias . '.stars', $options['stars']])->andFilterWhere(['=', $hotelAlias . '.type', $options['type']])->from([$hotelAlias, self::tableName()])->orderBy(self::tableName() . '.created_at DESC');
     return $provider;
 }