public function search($params)
 {
     $query = WarehouseModel::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id_warehouse' => $this->id_warehouse, 'id_branch' => $this->id_branch, 'create_by' => $this->create_by, 'update_by' => $this->update_by]);
     $query->andFilterWhere(['like', 'cd_whse', $this->cd_whse])->andFilterWhere(['like', 'nm_whse', $this->nm_whse])->andFilterWhere(['like', 'create_date', $this->create_date])->andFilterWhere(['like', 'update_date', $this->update_date]);
     return $dataProvider;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdWarehouse()
 {
     return $this->hasOne(Warehouse::className(), ['id_warehouse' => 'id_warehouse']);
 }
Exemple #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getWarehouses()
 {
     return $this->hasMany(Warehouse::className(), ['id_branch' => 'id_branch']);
 }
Exemple #4
0
 public static function getWarehouseList($branch = false)
 {
     $query = Warehouse::find();
     if ($branch !== false) {
         $query->where(['id_branch' => $branch]);
     }
     return ArrayHelper::map($query->asArray()->all(), 'id_warehouse', 'nm_whse');
 }
 /**
  * Finds the Warehouse model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Warehouse the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Warehouse::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }