当前位置: 首页>>代码示例>>PHP>>正文


PHP Reservation::model方法代码示例

本文整理汇总了PHP中Reservation::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Reservation::model方法的具体用法?PHP Reservation::model怎么用?PHP Reservation::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Reservation的用法示例。


在下文中一共展示了Reservation::model方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: populate

    public function populate($roomType, $dates)
    {
        $this->roomType = $roomType;
        foreach ($dates as $date) {
            $criteria = new CDbCriteria();
            $criteria->condition = ':date between dateFrom and dateTo 
									and roomid=:roomId
									and confirmreservation=true';
            $criteria->params = array(":date" => $date, ":roomId" => $this->roomType->id);
            $result = Reservation::model()->findAll($criteria);
            $this->reservations[$date] = $result;
        }
    }
开发者ID:1060460048,项目名称:Yii-reservation-booking-module,代码行数:13,代码来源:ReservationSheetRow.php

示例2: testUpdate

 /**
  * Test we can update the reservation.
  */
 public function testUpdate()
 {
     $this->resetReservationTable();
     $this->resetDateTimes();
     $reservation = new Reservation();
     $reservation->setAttributes(array('roomid' => 1, 'datefrom' => $this->_dateOverlapFrom, 'numberofnights' => $this->_numberofnights));
     $reservation->save(false);
     $newDateTo = DateTime::createFromFormat('Y-m-d', $this->_dateOverlapToObj->format('Y-m-d'));
     $newDateTo->add(new DateInterval('P10D'));
     $reservation = Reservation::model()->findByPk($reservation->getAttribute('id'));
     $reservation->setAttribute('dateto', $newDateTo->format('Y-m-d'));
     $reservation->setAttribute('confirmreservation', true);
     //must run validation rules
     $this->assertTrue($reservation->save());
     $reservation = Reservation::model()->findByPk($reservation->getAttribute('id'));
     $this->assertEquals($newDateTo->format('Y-m-d'), $reservation->dateto);
 }
开发者ID:bogiesoft,项目名称:YiiHotelReservation,代码行数:20,代码来源:ReservationTest.php

示例3: actionCreate

 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'payment' page.
  */
 public function actionCreate()
 {
     $model = new ReservationDetails();
     $model->reservation = Reservation::model()->findByPk(Yii::app()->session['reservationid']);
     $model->reservation->setAttribute('confirmreservation', true);
     if (isset($_POST['ReservationDetails'])) {
         if ($model->reservation->save()) {
             $model->attributes = $_POST['ReservationDetails'];
             $model->setAttribute('reservationid', $model->reservation->id);
             if ($model->save()) {
                 if (!Yii::app()->user->isGuest) {
                     $this->redirect(array('reservation/update', 'id' => $model->reservation->id));
                 } else {
                     $this->redirect(array('viewPayment'));
                 }
             }
         } else {
             throw new CHttpException(500, 'Unable to save reservation');
         }
     }
     $this->render('create', array('model' => $model));
 }
开发者ID:bogiesoft,项目名称:YiiHotelReservation,代码行数:26,代码来源:ReservationDetailsController.php

示例4: actionCancel

 public function actionCancel($id)
 {
     $reservation = Reservation::model()->findByPk($id);
     if (isset($reservation)) {
         $reservation->status = 'CANCELED';
         $reservation->save();
     }
     $this->redirect(Yii::app()->request->getBaseUrl(true) . '#cuenta');
 }
开发者ID:frankpaul142,项目名称:edenblue,代码行数:9,代码来源:SiteController.php

示例5: loadModel

 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Reservation::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
开发者ID:bogiesoft,项目名称:YiiHotelReservation,代码行数:13,代码来源:ReservationController.php


注:本文中的Reservation::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。