/** * @param TemaFilter $filter * @return boolean|TemaQuery */ public function andFilter($filter) { if (!$filter->validate()) { return false; } return $this->andFilterWhere(['and', ['like', 'tema.nazvanie', $filter->nazvanie], ['prepodavatel.id' => $filter->prepodavatelId]]); }
public function actionTemaList($kurs) { Yii::$app->response->format = Response::FORMAT_JSON; $query = Tema::find()->customInfo()->where(['kurs.id' => $kurs]); $filter = new TemaFilter(); if ($filter->load(Yii::$app->request->get(), '') && !$query->andFilter($filter)) { throw new BadRequestHttpException(); } return $query->formatted(); }