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

        /**
         * @param int $open_source_user_ecommerce_id
         * @return object
         * @throws Exception
         */
        public function getCustomerByOpenSouceUserEcommerceId($open_source_user_ecommerce_id = 0)
        {
            $tableCustomer = $this->getTable();
            $tableCustomer->load(array(
                'user_open_source_commerce_id' => $open_source_user_ecommerce_id
            ));
            return (object)$tableCustomer->getProperties();
        }
    }
}
