Exemplo n.º 1
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Reservationinfo::find()->select('reservationinfo.*')->leftJoin('objreservation', 'objreservation.id = reservationinfo.objreservation_id')->leftJoin('customers', 'objreservation.customer_id = customers.id')->leftJoin('user', 'customers.user_id = user.id')->where(['user.id' => Yii::$app->user->id]);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     Yii::info($params);
     Yii::info($this->objreservation_id);
     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, 'objreservation_id' => $this->objreservation_id, 'date_begin' => $this->date_begin != "" ? strtotime($this->date_begin) : $this->date_begin, 'date_end' => $this->date_end != "" ? strtotime($this->date_end) : $this->date_end, 'qty' => $this->qty, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     return $dataProvider;
 }
 /**
  * Finds the Reservationinfo model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Reservationinfo the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Reservationinfo::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getReservationinfos()
 {
     return $this->hasMany(Reservationinfo::className(), ['obj_reservation_id' => 'id']);
 }
Exemplo n.º 4
0
 public function getReservationinfo()
 {
     return $this->hasOne(Reservationinfo::className(), ['id' => 'reservationinfo_id']);
 }