/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = SbmWorkOrder::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, 'adhoc_order_request_id' => $this->adhoc_order_request_id, 'due_date' => $this->due_date, 'approver' => $this->approver, 'sale_order_id' => $this->sale_order_id, 'repeat_ref_id' => $this->repeat_ref_id, 'order_date' => $this->order_date, 'location_id' => $this->location_id, 'customer_site_id' => $this->customer_site_id, 'approver2' => $this->approver2, 'approver3' => $this->approver3, 'customer_id' => $this->customer_id]); $query->andFilterWhere(['like', 'state', $this->state])->andFilterWhere(['like', 'work_location', $this->work_location])->andFilterWhere(['like', 'source_type', $this->source_type])->andFilterWhere(['like', 'wo_no', $this->wo_no])->andFilterWhere(['like', 'request_no', $this->request_no])->andFilterWhere(['like', 'notes', $this->notes])->andFilterWhere(['like', 'seq_wo_no', $this->seq_wo_no])->andFilterWhere(['like', 'seq_req_no', $this->seq_req_no]); return $dataProvider; }
/** * @return \yii\db\ActiveQuery */ public function getSbmWorkOrders() { return $this->hasMany(SbmWorkOrder::className(), ['adhoc_order_request_id' => 'id']); }
/** * Finds the SbmWorkOrder model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return SbmWorkOrder the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = SbmWorkOrder::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
/** * @return \yii\db\ActiveQuery */ public function getWorkOrder() { return $this->hasOne(SbmWorkOrder::className(), ['id' => 'work_order_id']); }
/** * @return \yii\db\ActiveQuery */ public function getSbmWorkOrders() { return $this->hasMany(SbmWorkOrder::className(), ['repeat_ref_id' => 'id']); }