<?php
namespace TourOperatorProAdminWoopanel\app\models;
defined('_TOUROPERATOR_EXEC') or die;
use TourOperatorPro\Factory;
use TourOperatorPro\Mvc\Model\ModelForm;
use TourOperatorPro\Form\Form;
use TourOperatorPro\Mvc\Model\ModelList;
use TourOperatorPro\Registry\Registry;
class TourTypesModel extends ModelList
{
    /**
     * @var string
     */
    public $context = "tourtypes";
    /**
     * @var string
     */
    public $table_name = "tourtype";

    public function getListQuery()
    {

        $query=$this->db->getQuery(true);
        $query->select("a.*")
            ->from($this->getTableName().' AS a')

        ;
        $query->order('a.id DESC');

        return $query;
    }
    public function getList()
    {
        $db=Factory::getDBO();
        $query=$this->getListQuery();

        return $db->setQuery($query)->loadObjectList();
    }
    public function getListQuery_tourtype_public()
    {
        $db = Factory::getDBO();
        $query = $this->db->getQuery(true);
        $query->select('tourtype.*')
            ->from($this->getTableName('tourtype') . ' AS tourtype')
            ->where('tourtype.published=1');
        return $query;
    }
    public function getList_tourtype_public()
    {
        $db=Factory::getDBO();
        $query=$this->getListQuery_tourtype_public();
        $limit_per_page=$this->get_limit_per_page();

        return $db->setQuery($query, $this->getStart(),$limit_per_page)->loadObjectList();
    }
}
