<?php
namespace WpBookingHotelAdmin\app\models;
defined('_WPBOOKINGHOTEL_EXEC') or die;

use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Model\ModelForm;
use WpBookingHotel\Form\Form;
use WpBookingHotel\Mvc\Model\ModelList;
use WpBookingHotel\Registry\Registry;
class TagModel extends ModelForm
{
    /**
     * @var string
     */
    public $context = "tag";
    /**
     * @var string
     */
    public $table_name = "tag";
    public function getTagByName($name)
    {
        $db = Factory::getDBO();
        $query = $db->getQuery(true);
        $query->select('*')
            ->from($this->getTableName())
            ->where('name=' . $query->quote($name));
        $tag = $db->setQuery($query)->loadObject();
        return $tag;
    }
}
