예제 #1
0
 /**
  * @param Hotel $hotel
  *
  * @return $this
  */
 public function updateHotel($hotel)
 {
     $newData = array('brandName' => $hotel->getBrand()->getName(), 'brandSlug' => strtolower($hotel->getBrand()->getArtsysID()), 'name' => $hotel->getName(), 'latLng' => array('lat' => $hotel->getLatitude(), 'lng' => $hotel->getLongitude()), 'active' => $hotel->isValid());
     if ($hotel->getCity()) {
         $newData['cityId'] = sprintf('city%s', $hotel->getCity()->getId());
     }
     try {
         $document = $this->hotelType->getDocument($hotel->getId());
     } catch (NotFoundException $e) {
         $this->addHotel($hotel);
         $document = $this->hotelType->getDocument($hotel->getId());
     }
     $data = $document->getData();
     $newData = array_merge($data, $newData);
     $document->setData($newData);
     $this->hotelType->updateDocument($document);
     return $this;
 }