/** * Finds the Importemployee model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Importemployee the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Importemployee::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Importemployee::find(); $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['importemployee_combination' => SORT_ASC]]]); $query->joinWith(['idpodraz', 'idbuild']); $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(['importemployee_id' => $this->importemployee_id, 'id_build' => $this->id_build, 'id_podraz' => $this->id_podraz]); $query->andFilterWhere(['like', 'importemployee_combination', $this->importemployee_combination]); $query->andFilterWhere(['LIKE', 'idbuild.build_name', $this->getAttribute('idbuild.build_name')]); $query->andFilterWhere(['LIKE', 'idpodraz.podraz_name', $this->getAttribute('idpodraz.podraz_name')]); Proc::AssignRelatedAttributes($dataProvider, ['idbuild.build_name', 'idpodraz.podraz_name']); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getImportemployees() { return $this->hasMany(Importemployee::className(), ['id_podraz' => 'podraz_id'])->from(['importemployees' => Importemployee::tableName()]); }
/** * @return \yii\db\ActiveQuery */ public function getIdimportemployee() { return $this->hasOne(Importemployee::className(), ['importemployee_id' => 'id_importemployee'])->from(['idimportemployee' => Importemployee::tableName()]); }