<?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 SeasonsModel extends ModelList
{
    /**
     * @var string
     */
    public $context = "seasons";
    /**
     * @var string
     */
    public $table_name = "season";
    public function getList()
    {
        $list = parent::getList(); // TODO: Change the autogenerated stub
        $query = $this->db->getQuery(true);
        foreach ($list as &$item) {
            $query->clear()
                ->select('tour.*')
                ->from($this->getTableName('tour') . ' AS tour')
                ->where('tour.season_id=' . (int)$item->id);
            $item->list_tour = $this->db->setQuery($query)->loadObjectList();
        }
        return $list;
    }
    public function getList_season_public()
    {
        $db=Factory::getDBO();
        $query = $this->db->getQuery(true);
        $query->select('season.*')
            ->from($this->getTableName('season') . ' AS season');
        return $db->setQuery($query)->loadObjectList();
    }




}
