<?php
namespace WpBookingHotelAdminWooPanel\app\helpers;

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

class DestinationHelper extends AdminHelper
{
    public static function getWpBookingDestinationKey(){
        return 'destination';
    }

    public static function insertNewPropertyByKey($key='', $list_hotel_id=array(), $destination_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)$destination_id)
                ->set('type='.$query->quote($key))
                ->set('hotel_id='.(int)$hotel_id)
            ;
            $db->setQuery($query)->execute();
        }
    }

}