<?php
namespace WpBookingHotelFrontend\app\helpers;

use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\Model as ModelAlias;
use WpBookingHotel\Utilities\Utility;

class SmsHelper extends FrontendHelper
{

    public static function get_sms_info_booking(){
        $db=Factory::getDBO();
        $query=$db->getQuery(true);
        $send_info_booking=static::get_sms_action_info_booking();
        $query->select("sms.*")
            ->from(Utility::getTableName('sms'). ' AS sms')
            ->where('sms.published=1')
            ;
        $sms=$db->setQuery($query)->loadObject();

        $query->select("smscontent.*")
            ->from(Utility::getTableName('smscontent'). ' AS smscontent')
            ->where('smscontent.action_sms='.$query->quote($send_info_booking))
            ;
        $sms_content=$db->setQuery($query)->loadObject();
        foreach ($sms_content as $key => $value) {
            if($key != 'id') {
                $sms->{$key} = $value;
            }
        }

        return $sms;

    }
    public static function get_sms_action_info_booking(){
        return "first_send";
    }

}