src/Entity/News/NewsTag.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity\News;
  3. use App\Annotation\SiteAware;
  4. use App\Entity\AbstractBase;
  5. use App\Entity\Interfaces\PublishedInterface;
  6. use App\Entity\Interfaces\SiteInterface;
  7. use App\Entity\Interfaces\SlugInterface;
  8. use App\Entity\MiniAbstractBase;
  9. use App\Entity\Traits\NameTrait;
  10. use App\Entity\Traits\PublishedTrait;
  11. use App\Entity\Traits\SiteTrait;
  12. use App\Entity\Traits\SlugTrait;
  13. use App\Repository\News\NewsTagRepository;
  14. use Doctrine\ORM\Mapping as ORM;
  15. use Gedmo\Mapping\Annotation as Gedmo;
  16. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  17. /**
  18.  * @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"})})
  19.  * @ORM\Entity(repositoryClass=NewsTagRepository::class)
  20.  * @SiteAware(siteFieldName="site")
  21.  * @UniqueEntity("slug")
  22.  */
  23. class NewsTag extends AbstractBase implements SiteInterfaceSlugInterfacePublishedInterface
  24. {
  25.     use NameTrait;
  26.     use PublishedTrait;
  27.     use SiteTrait;
  28.     use SlugTrait;
  29.     /**
  30.      * @ORM\Column(type="string", length=200, nullable=false)
  31.      */
  32.     private string $name;
  33.     /**
  34.      * @ORM\Column(type="string", length=255, nullable=false)
  35.      * @Gedmo\Slug(fields={"name"}, unique=false, updatable=false)
  36.      */
  37.     private string $slug;
  38.     public function __construct()
  39.     {
  40.     }
  41.     public function __toString(): string
  42.     {
  43.         return $this->id $this->getName() : MiniAbstractBase::DEFAULT_EMPTY_STRING;
  44.     }
  45. }