/**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = SbmAdhocOrderRequest::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, 'create_uid' => $this->create_uid, 'create_date' => $this->create_date, 'write_date' => $this->write_date, 'write_uid' => $this->write_uid, 'term_of_payment' => $this->term_of_payment, 'attention_id' => $this->attention_id, 'sales_man_id' => $this->sales_man_id, 'customer_site_id' => $this->customer_site_id, 'sale_group_id' => $this->sale_group_id, 'customer_id' => $this->customer_id]);
     $query->andFilterWhere(['like', 'cust_ref_no', $this->cust_ref_no])->andFilterWhere(['like', 'scope_of_work', $this->scope_of_work])->andFilterWhere(['like', 'term_condition', $this->term_condition])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'cust_ref_type', $this->cust_ref_type])->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'notes', $this->notes]);
     return $dataProvider;
 }
 /**
  * Finds the SbmAdhocOrderRequest model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return SbmAdhocOrderRequest the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = SbmAdhocOrderRequest::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getAdhocOrderRequest()
 {
     return $this->hasOne(SbmAdhocOrderRequest::className(), ['id' => 'adhoc_order_request_id']);
 }