/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = StockOpnameModel::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); if (!($this->load($params) && $this->validate())) { return $dataProvider; } $query->andFilterWhere(['id_opname' => $this->id_opname, 'id_warehouse' => $this->id_warehouse, 'opname_date' => $this->opname_date, 'status' => $this->status, 'create_at' => $this->create_at, 'create_by' => $this->create_by, 'update_at' => $this->update_at, 'update_by' => $this->update_by]); $query->andFilterWhere(['like', 'opname_num', $this->opname_num])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'operator1', $this->operator1])->andFilterWhere(['like', 'operator2', $this->operator2])->andFilterWhere(['like', 'operator3', $this->operator3]); return $dataProvider; }
public static function modelClass() { return MStockOpname::className(); }
/** * @return \yii\db\ActiveQuery */ public function getIdOpname() { return $this->hasOne(StockOpname::className(), ['id_opname' => 'id_opname']); }
/** * Finds the StockOpname model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return StockOpname the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = StockOpname::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }