<?php
defined('_WPBOOKINGPRO_EXEC') or die;
if(!class_exists("WpBookingPro_UserModel")) {
    /**
     * Class WpBookingPro_UserModel
     */
    class WpBookingPro_UserModel extends WoobookingModelForm
    {
        /**
         * @var string
         */
        public $table_name = "user";
        /**
         * @var string
         */
        public $context = "user";
        /**
         * @var string
         */
        public $modelItem = "user";

        /**
         * @param $open_source_user_id
         * @return mixed
         */
        public function getUserByOpenSourceUserId($open_source_user_id)
        {
            $db = $this->db;
            $query = $db->getQuery(true)
                ->select("user.*")
                ->from($this->getTableName('user') . ' AS user')
                ->where('user.open_source_user_id=' . (int)$open_source_user_id);
            $user = $db->setQuery($query)->loadObject();
            return $user;
        }
    }
}
