src/Entity/SectionTitle.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SectionTitleRepository;
  4. use App\Traits\CommonTrt;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. /**
  9.  * @ORM\Entity(repositoryClass=SectionTitleRepository::class)
  10.  */
  11. class SectionTitle
  12. {
  13.     use CommonTrt;
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $title;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private $subtitle;
  28.     /**
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      */
  31.     private $image;
  32.     /**
  33.      * @ORM\Column(type="boolean")
  34.      */
  35.     private $isActive;
  36.     /**
  37.      * @ORM\ManyToMany(targetEntity=Tag::class, inversedBy="sectionTitles")
  38.      */
  39.     private $tag;
  40.     public function __construct()
  41.     {
  42.         $this->tag = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getTitle(): ?string
  49.     {
  50.         return $this->title;
  51.     }
  52.     public function setTitle(string $title): self
  53.     {
  54.         $this->title = $title;
  55.         return $this;
  56.     }
  57.     public function getSubtitle(): ?string
  58.     {
  59.         return $this->subtitle;
  60.     }
  61.     public function setSubtitle(?string $subtitle): self
  62.     {
  63.         $this->subtitle = $subtitle;
  64.         return $this;
  65.     }
  66.     public function getImage(): ?string
  67.     {
  68.         return $this->image;
  69.     }
  70.     public function setImage(?string $image): self
  71.     {
  72.         $this->image = $image;
  73.         return $this;
  74.     }
  75.     public function isIsActive(): ?bool
  76.     {
  77.         return $this->isActive;
  78.     }
  79.     public function setIsActive(bool $isActive): self
  80.     {
  81.         $this->isActive = $isActive;
  82.         return $this;
  83.     }
  84.     /**
  85.      * @return Collection<int, Tag>
  86.      */
  87.     public function getTag(): Collection
  88.     {
  89.         return $this->tag;
  90.     }
  91.     public function addTag(Tag $tag): self
  92.     {
  93.         if (!$this->tag->contains($tag)) {
  94.             $this->tag[] = $tag;
  95.         }
  96.         return $this;
  97.     }
  98.     public function removeTag(Tag $tag): self
  99.     {
  100.         $this->tag->removeElement($tag);
  101.         return $this;
  102.     }
  103. }