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

        /**
         * @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;
        }
    }
}