HEX
Server: LiteSpeed
System: Linux s917.lon1.mysecurecloudhost.com 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: assibfaf (3034)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/assibfaf/public_html/prox-classes/Order/Rating.php
<?php
/**
 * @package    Proxim
 * @author     Davison Pro <davisonpro.coder@gmail.com | https://davisonpro.dev>
 * @copyright  2019 Proxim
 * @version    1.0.0
 * @since      File available since Release 1.0.0
 */

namespace Proxim\Order;

use Db;
use Proxim\Database\DbQuery;
use Proxim\Cache\Cache;
use Proxim\ObjectModel;
use Proxim\User\Customer;
use Proxim\Util\ArrayUtils;
use Proxim\Util\DateUtils;
use Proxim\Validate;
use Proxim\Tools;

/**
 * Rating
 */
class Rating extends ObjectModel
{
	/** @var $id Rating ID */
	public $id;
	
    /** @var int order_id */
	public $order_id;

	/** @var int paper_rating */
	public $paper_rating = 0;
	
	/** @var int service_rating */
	public $service_rating = 0;
	
	/** @var string comment */
	public $comment;

	/** @var bool paper_on_time */
	public $paper_on_time = 0;

	/** @var string date_upd */
	public $date_upd;
	
	/** @var string date_add */
	public $date_add;
	
	/**
     * @see ObjectModel::$definition
     */
    public static $definition = array(
        'table' => 'order_rating',
        'primary' => 'rating_id',
        'fields' => array(
            'order_id' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt', 'required' => true),
            'paper_rating' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
            'service_rating' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
            'comment' => array('type' => self::TYPE_STRING),
            'paper_on_time' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
            'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDateOrNull'),
            'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDateOrNull'),
        ),
    );

    /**
     * constructor.
     *
     * @param null $id
     */
    public function __construct($id = null) {
		parent::__construct($id);
    }
    
    public function present() {
        $feedback = array(
            'id' => (int) $this->id,
            'order_id' => (int) $this->order_id,
            'paper_rating' => (int) $this->paper_rating,
            'service_rating' => (int) $this->service_rating,
            'paper_on_time' => (bool) $this->paper_on_time,
            'comment' => $this->comment,
            'date' => DateUtils::convertToISOFormat($this->date_add)
        );

        return $feedback;
    }

}