<?phpnamespace App\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass="App\Repository\TagRepository") * * @ORM\HasLifecycleCallbacks() */class Tag{ public function __construct() { $this->article_tags = new ArrayCollection(); } /** * @ORM\Id() * * @ORM\GeneratedValue() * * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", nullable=false, length=180) */ private $name = null; /** * @ORM\Column(type="string", nullable=true, length=180) */ private $slug = null; public function getId(): ?int { return $this->id; } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; return $this; } public function getSlug() { return $this->slug; } public function setSlug($slug) { $this->slug = $slug; return $this; } /** * @ORM\Column(type="datetime", nullable=false) */ private $created_at; /** * @ORM\Column(type="datetime", nullable=true) */ private $updated_at = null; public function getCreatedAt(): \DateTimeInterface { return $this->created_at; } public function setCreatedAt(\DateTimeInterface $created_at): self { $this->created_at = $created_at; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updated_at; } public function setUpdatedAt(?\DateTimeInterface $updated_at): self { $this->updated_at = $updated_at; return $this; } /** * @ORM\PrePersist */ public function setCreatedAtValue() { $this->setCreatedAt(new \DateTime()); } /** * @ORM\PreUpdate */ public function setUpdatedAtValue() { $this->setUpdatedAt(new \DateTime()); } /** * @ORM\Column(type="datetime", nullable=true) */ private $deleted_at; public function getDeletedAt(): ?\DateTimeInterface { return $this->deleted_at; } public function setDeletedAt(?\DateTimeInterface $deleted_at): self { $this->deleted_at = $deleted_at; return $this; } // Target of a LinkedEntity from TagController (Controller) /** * @ORM\OneToMany(targetEntity="App\Entity\ArticleTag", mappedBy="tag") */ private $article_tags; /** * @ORM\Column(type="integer", nullable=true) */ private $legacy_id; /** * @return Collection|ArticleTag[] */ public function getArticleTags(): Collection { return $this->article_tags; } public function addArticleTag(ArticleTag $article_tag): self { if (!$this->article_tags->contains($article_tag)) { $this->article_tags[] = $article_tag; $article_tag->setTag($this); } return $this; } public function removeArticleTag(ArticleTag $article_tag): self { if ($this->article_tags->contains($article_tag)) { $this->article_tags->removeElement($article_tag); if ($article_tag->getTag() === $this) { $article_tag->setTag(null); } } return $this; } public function getLegacyId(): ?int { return $this->legacy_id; } public function setLegacyId(?int $legacy_id): self { $this->legacy_id = $legacy_id; return $this; }}