<?php
namespace WpBookingHotelAdmin\app\helpers;

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

class DiscountHelper extends AdminHelper
{
    public static function getWpBookingDiscountKey(){
        return 'discount';
    }
    public static function insertNewPropertyByKey($key='', $list_hotel_id=array(), $discount_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)$discount_id)
                ->set('type='.$query->quote($key))
                ->set('hotel_id='.(int)$hotel_id)
            ;
            $db->setQuery($query)->execute();
        }
    }

}