public function search($params) { $query = City::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $query->andFilterWhere([City::tableName() . '.status' => '1']); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['Id' => $this->Id, 'stateId' => $this->stateId, 'cityStdCode' => $this->cityStdCode, 'createdOn' => $this->createdOn, 'status' => $this->status, 'isFg' => $this->isFg, 'priority' => $this->priority, 'parentCityId' => $this->parentCityId, 'updatedOn' => $this->updatedOn, 'createdBy' => $this->createdBy, 'updatedBy' => $this->updatedBy]); $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'alias', $this->alias])->andFilterWhere(['like', 'ip', $this->ip]); return $dataProvider; }
public static function getCityCountTotalSql() { $param = self::CITY_COUNT_TOTAL; $cityTable = City::tableName(); return $sql = <<<SQL select '{$param}' as param, count(*) as value from {$cityTable} where active = 1 SQL; return null; }