<?php
namespace WpBookingEventAdmin\app\models;
defined('_WPBOOKINGEVENT_EXEC') or die;

use WpBookingEvent\Factory;
use WpBookingEvent\Mvc\Model\ModelForm;
use WpBookingEvent\Form\Form;
use WpBookingEvent\Mvc\Model\ModelList;
use WpBookingEvent\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;
    }
}
