/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Haus::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id, 'projekt_id' => $this->projekt_id, 'reserviert' => $this->reserviert, 'verkauft' => $this->verkauft, 'rechnung_vertrieb' => $this->rechnung_vertrieb]); $query->andFilterWhere(['like', 'plz', $this->plz])->andFilterWhere(['like', 'ort', $this->ort])->andFilterWhere(['like', 'strasse', $this->strasse])->andFilterWhere(['like', 'hausnr', $this->hausnr]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getHaus() { return $this->hasOne(Haus::className(), ['id' => 'haus_id']); }
/** * Finds the Haus model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Haus the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Haus::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getHauses() { return $this->hasMany(Haus::className(), ['projekt_id' => 'id']); }