<?php
namespace App\Entity\News;
use App\Annotation\SiteAware;
use App\Entity\AbstractBase;
use App\Entity\Interfaces\PublishedInterface;
use App\Entity\Interfaces\SiteInterface;
use App\Entity\Interfaces\SlugInterface;
use App\Entity\MiniAbstractBase;
use App\Entity\Traits\NameTrait;
use App\Entity\Traits\PublishedTrait;
use App\Entity\Traits\SiteTrait;
use App\Entity\Traits\SlugTrait;
use App\Repository\News\NewsTagRepository;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
/**
* @ORM\Table(name="vulco_news_tag", indexes={@ORM\Index(name="news_tag_site_idx", columns={"site"})}, uniqueConstraints={@ORM\UniqueConstraint(name="news_tag_search_idx", columns={"site", "slug"})})
* @ORM\Entity(repositoryClass=NewsTagRepository::class)
* @SiteAware(siteFieldName="site")
* @UniqueEntity("slug")
*/
class NewsTag extends AbstractBase implements SiteInterface, SlugInterface, PublishedInterface
{
use NameTrait;
use PublishedTrait;
use SiteTrait;
use SlugTrait;
/**
* @ORM\Column(type="string", length=200, nullable=false)
*/
private string $name;
/**
* @ORM\Column(type="string", length=255, nullable=false)
* @Gedmo\Slug(fields={"name"}, unique=false, updatable=false)
*/
private string $slug;
public function __construct()
{
}
public function __toString(): string
{
return $this->id ? $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
}
}