/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Datenblatt::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; } //var_dump($this->projektname); $query->andFilterWhere(['id' => $this->id, 'firma_id' => $this->firma_id, 'projekt_id' => $this->projekt_id, 'haus_id' => $this->haus_id, 'nummer' => $this->nummer, 'kaeufer_id' => $this->kaeufer_id]); $query->andFilterWhere(['like', 'besondere_regelungen_kaufvertrag', $this->besondere_regelungen_kaufvertrag])->andFilterWhere(['like', 'sonstige_anmerkungen', $this->sonstige_anmerkungen]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getDatenblatt() { return $this->hasOne(Datenblatt::className(), ['id' => 'datenblatt_id']); }
/** * @return \yii\db\ActiveQuery */ public function getDatenblatts() { return $this->hasMany(Datenblatt::className(), ['haus_id' => 'id']); }
/** * Finds the Datenblatt model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Datenblatt the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Datenblatt::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }