Esempio n. 1
0
 public function saveToOrderDb()
 {
     if ($this->hotel) {
         $order = $this->hotel->saveToOrderDb();
         $order->searchParams = serialize($this->searchParams);
         return $order->update(array('searchParams'));
     } else {
         //we have only search params now
         $order = new OrderHotel();
         $order->cityId = $this->city;
         $order->checkIn = $this->checkIn;
         $order->duration = $this->getDuration();
         $order->searchParams = serialize($this->searchParams);
         if ($order->save()) {
             return $order;
         }
     }
     return false;
 }
Esempio n. 2
0
 public function saveToOrderDb()
 {
     $key = $this->getId();
     $order = OrderHotel::model()->findByAttributes(array('key' => $key));
     if (!$order) {
         $order = new OrderHotel();
     }
     $order->key = $key;
     $order->checkIn = $this->checkIn;
     $order->duration = $this->duration;
     $city = City::model()->getCityByHotelbookId($this->cityId);
     $order->cityId = $city->id;
     $order->object = serialize($this);
     if ($order->save()) {
         $this->internalId = $order->id;
         return $order;
     }
     return false;
 }