<?phpnamespace Bundles\Messenger\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;use Bundles\Messenger\Repository\ArticleRepository;/** * @ORM\Entity(repositoryClass=ArticleRepository::class) */class Article { /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) */ private $title; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\Column(type="text", nullable=true) */ private $content; /** * @ORM\Column(type="string", length=20) */ private $created; /** * @ORM\Column(type="boolean") */ private $status; /** * @ORM\Column(type="boolean") */ private $new = true; /** * @ORM\Column(type="string", length=20, nullable=true) */ private $showFrom; /** * @ORM\Column(type="string", length=20, nullable=true) */ private $showTo; /** * @ORM\ManyToMany(targetEntity=ArticleTag::class) * @ORM\JoinTable(name="article_related_tags") * */ private $tags; public function __construct() { $this->tags = new ArrayCollection(); $this->setCreated(date('Y-m-d H:i')); } public function getId(): ?int { return $this->id; } public function getTitle(): ?string { return $this->title; } public function setTitle(string $title): self { $this->title = $title; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public function getContent(): ?string { return $this->content; } public function setContent(string $content): self { $this->content = $content; return $this; } public function getCreated(): ?string { return $this->created; } public function setCreated(string $created): self { $this->created = $created; return $this; } public function isStatus(): ?bool { return $this->status; } public function setStatus(bool $status): self { $this->status = $status; return $this; } public function getShowFrom(): ?string { return $this->showFrom; } public function setShowFrom(?string $showFrom): self { $this->showFrom = $showFrom; return $this; } public function getShowTo(): ?string { return $this->showTo; } public function setShowTo(?string $showTo): self { $this->showTo = $showTo; return $this; } /** * @return Collection<int, ArticleTag> */ public function getTags(): Collection { return $this->tags; } public function addTag(ArticleTag $tag): self { if (!$this->tags->contains($tag)) { $this->tags[] = $tag; $tag->setArticle($this); } return $this; } public function removeTag(ArticleTag $tag): self { if ($this->tags->removeElement($tag)) { // set the owning side to null (unless already changed) if ($tag->getArticle() === $this) { $tag->setArticle(null); } } return $this; } /** * @return bool */ public function isNew(): bool { return $this->new; } /** * @param bool $new */ public function setNew(bool $new = true): void { $this->new = $new; }}