<?php
namespace WpBookingHotelAdmin\app\helpers;

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

class ServiceHelper extends AdminHelper
{
    public static function getWpBookingServiceKey(){
        return 'service';
    }
    public static function insertNewPropertyByKey($key='', $list_hotel_id=array(), $service_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)$service_id)
                ->set('type='.$query->quote($key))
                ->set('hotel_id='.(int)$hotel_id)
            ;
            $db->setQuery($query)->execute();
        }
    }

}