/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = OFFICELOCATIONS::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['OFFICE_LOCATION_ID' => $this->OFFICE_LOCATION_ID, 'COMPANY_ID' => $this->COMPANY_ID]); $query->andFilterWhere(['like', 'STREET_ADDRESS', $this->STREET_ADDRESS])->andFilterWhere(['like', 'CITY', $this->CITY])->andFilterWhere(['like', 'STATE', $this->STATE])->andFilterWhere(['like', 'ZIP', $this->ZIP])->andFilterWhere(['like', 'PHONE', $this->PHONE])->andFilterWhere(['like', 'FAX', $this->FAX])->andFilterWhere(['like', 'BRANCH_NUMBER', $this->BRANCH_NUMBER]); return $dataProvider; }
/** * Finds the OFFICELOCATIONS model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return OFFICELOCATIONS the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = OFFICELOCATIONS::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getOFFICELOCATIONSs() { return $this->hasMany(OFFICELOCATIONS::className(), ['COMPANY_ID' => 'COMPANY_ID']); }