<?php
namespace WpBookingProFrontend\app\helpers;

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

class SmsHelper extends FrontendHelper
{

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

        $query->clear()
            ->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;

    }

}