/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Peoples::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(['peopleId' => $this->peopleId, 'peopleBirthday' => $this->peopleBirthday, 'peopleWorking' => $this->peopleWorking, 'peopleFluDate' => $this->peopleFluDate, 'peopleFluResult' => $this->peopleFluResult, 'peopleFluTerm' => $this->peopleFluTerm, 'peopleStreet' => $this->peopleStreet, 'peopleAdress' => $this->peopleAdress, 'fluInfo' => $this->peopleFluNumber]); $query->andFilterWhere(['like', 'peopleFIO', $this->peopleFIO])->andFilterWhere(['like', 'peopleFluNumber', $this->peopleFluNumber]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getPeoples() { return $this->hasMany(Peoples::className(), ['peopleWorking' => 'workingId']); }
/** * Экшн поиска людей по улице и сроку флюры. * @return mixed */ public function actionPprintfind($streetId) { $model = new Peoples(); $peoplesArr = Peoples::find()->where(['peopleStreet' => $streetId])->all(); foreach ($peoplesArr as $p) { $findRes = graftsPeoples::find()->where(['peopleId' => $p['peopleId']])->all(); if (empty($findRes)) { continue; } else { foreach ($findRes as $f) { $graftName = Grafts::find()->where(['graftId' => $f['graftId']])->all(); $arr[$p['peopleId']][] = $graftName[0]['graftName']; } } } return $this->render('pprintFind', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'model' => $model, 'dt' => $peoplesArr]); }
/** * @return \yii\db\ActiveQuery */ public function getPeople() { return $this->hasOne(Peoples::className(), ['peopleId' => 'peopleId']); }
/** * @return \yii\db\ActiveQuery */ public function getPeoples() { return $this->hasMany(Peoples::className(), ['peopleStreet' => 'streetId']); }