public function setQuery($query) { $geo = new Geo(); $geo->reset(); $geo->installGeo($this->id_okrug, $this->id_region, $this->id_city); if ($geo->arrayCity) { $where["id_city"] = $geo->arrayCity; } if ($this->id_cat) { $cat = FCategory::findOne($this->id_cat); $arrayUsers = $cat->arrayUsers; $where["id"] = $arrayUsers; } if (isset($where)) { $query = $query->where($where); } if ($this->search != "") { $query = $query->andWhere(["or like", $this->search_field, $this->search]); } return $query; }