<?php
defined('_WPBOOKINGPRO_EXEC') or die;
if(!class_exists("WpBookingPro_TagModel")) {
    /**
     * Class WpBookingPro_TagModel
     */
    class WpBookingPro_TagModel extends WoobookingModelForm
    {
        /**
         * @var string
         */
        public $table_name = "tag";
        /**
         * @var string
         */
        public $context = "tag";

        /**
         * @param $name
         * @return mixed
         */
        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;
        }
    }
}