<?php
namespace WpBookingProAdmin\app\models;
defined('_WPBOOKINGPRO_EXEC') or die;

use WpBookingPro\Factory;
use WpBookingPro\Mvc\Model\ModelForm;
use WpBookingPro\Filesystem\File as FileAlias;
use WpBookingPro\Mvc\Model\Model;
use WpBookingPro\Form\Form;
use WpBookingPro\Mvc\Model\ModelList;
use WpBookingPro\Registry\Registry;
use WpBookingPro\Utilities\Utility;

class OrderdetailrateModel extends ModelForm
{
    /**
     * @var string
     */
    public $context = "orderdetailrate";
    /**
     * @var string
     */
    public $table_name = "order_detail_rate";

    public function saveChangeTimeOrder($data=array()) {
        $db = Factory::getDBO();
        $query = $db->getQuery(true);
        if(!empty($data)) {
            $query->update($this->getTableName().' AS order_detail_rate')
                ->set('order_detail_rate.start_date='. $query->quote($data['start_date']))
                ->set('order_detail_rate.end_date='. $query->quote($data['end_date']))
                ->where('order_detail_rate.id='.(int)$data['id'])
                ;
            $new_order = $db->setQuery($query)->loadObjectList();
        }
        return $new_order;
    }


}
