<?php
namespace WpBookingProFrontend\app\models;
defined('_WPBOOKINGPRO_EXEC') or die;

use WpBookingPro\Factory;
use WpBookingPro\Mvc\Model\Model;
use WpBookingPro\Mvc\Model\ModelForm;
use WpBookingPro\Form\Form;
use WpBookingPro\Mvc\Model\ModelList;
use WpBookingPro\Registry\Registry;
class CustomersModel extends ModelList
{
    /**
     * @var string
     */
    public $context = "customers";
    /**
     * @var string
     */
    public $table_name = "customer";
    public function getList()
    {
        if(is_user_logged_in()) {
            $modelUser = Model::getInstance('user');
            $user = $modelUser->getUserInfo();
            $db=Factory::getDBO();
            $query=$db->getQuery(true);
            $query->clear()
                ->select('*')
                ->from($this->getTableName('customer'))
                ->where('user_id='. (int)$user->data->user_plugin->id)
            ;

            return $db->setQuery($query)->loadObjectList();
        }
        return array();

    }


}
