<?php
namespace WpBookingHotelAdmin\app\helpers;

use WpBookingHotel\Factory;
use WpBookingHotel\Utilities\Utility;

class RateHelper extends AdminHelper
{

    public static function getWpBookingRoomtypeKey(){
        return 'rate';
    }

    public static function insertNewPropertyByKey($key='', $list_hotel_id=array(), $roomtype_id=0) {
        $db = Factory::getDBO();
        $query =$db->getQuery(true);
        foreach ($list_hotel_id as $hotel_id) {
            $query->clear()
                ->insert(Utility::getTableName('hotelproperty'))
                ->set('object_id='.(int)$roomtype_id)
                ->set('type='.$query->quote($key))
                ->set('hotel_id='.(int)$hotel_id)
            ;
            $db->setQuery($query)->execute();
        }
    }
}