src/Entity/Tag.php line 14

  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Trait\MainTranslationTrait;
  4. use App\Entity\Translation\TagTranslation;
  5. use App\Repository\TagRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Gedmo\Translatable\Translatable;
  9. #[Gedmo\TranslationEntity(class: self::TRANSLATION_ENTITY)]
  10. #[ORM\Entity(repositoryClassTagRepository::class)]
  11. class Tag implements Translatable
  12. {
  13.     use MainTranslationTrait;
  14.     const TRANSLATION_ENTITY TagTranslation::class;
  15.     public function __toString(): string
  16.     {
  17.         return $this->title ?? '';
  18.     }
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column]
  22.     private ?int $id null;
  23.     #[ORM\Column(type'string',nullabletrue)]
  24.     #[Gedmo\Translatable]
  25.     private ?string $title null;
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getTitle(): ?string
  31.     {
  32.         return $this->title;
  33.     }
  34.     public function setTitle(?string $title): self
  35.     {
  36.         $this->title $title;
  37.         return $this;
  38.     }
  39. }