Example #1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Warehouses::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]);
     $query->andFilterWhere(['like', 'Warehouse', $this->Warehouse])->andFilterWhere(['like', 'Address', $this->Address]);
     return $dataProvider;
 }
 /**
  * Finds the Warehouses model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Warehouses the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Warehouses::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Example #3
0
 /**
  * Relation to Warehouses table
  */
 public function getWarehouse()
 {
     return $this->hasOne(Warehouses::className(), ['ID' => 'Warehouse']);
 }
Example #4
0
    <?php 
echo $form->field($model, 'Type')->dropDownList(ArrayHelper::map(Types::find()->asArray()->all(), 'ID', 'Type'), ['prompt' => Yii::t('app', 'Select...')]);
?>

    <?php 
echo $form->field($model, 'Date')->widget(DatePicker::classname(), ['options' => ['placeholder' => Yii::t('app', 'Select...')], 'pluginOptions' => ['todayHighlight' => true, 'format' => 'yyyy-mm-dd', 'autoclose' => true]]);
?>


    <?php 
echo $form->field($model, 'From')->dropDownList(ArrayHelper::map(Warehouses::find()->asArray()->all(), 'ID', 'Warehouse'), ['prompt' => Yii::t('app', 'Select...')]);
?>

    <?php 
echo $form->field($model, 'To')->dropDownList(ArrayHelper::map(Warehouses::find()->asArray()->all(), 'ID', 'Warehouse'), ['prompt' => Yii::t('app', 'Select...')]);
?>

    <?php 
echo $form->field($model, 'Comment')->textarea(['rows' => 6]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Example #5
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getTo()
 {
     return $this->hasOne(Warehouses::className(), ['ID' => 'To'])->from(Warehouses::tableName() . ' WarehousesTo');
 }