posts = new ArrayCollection(); } 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 getSubTitle(): ?string { return $this->subTitle; } public function setSubTitle(?string $subTitle): self { $this->subTitle = $subTitle; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(string $description): self { $this->description = $description; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(?string $slug): self { $this->slug = $slug; return $this; } /** * @return Collection|Post[] */ public function getPosts(): Collection { return $this->posts; } public function addPost(Post $post): self { if (!$this->posts->contains($post)) { $this->posts[] = $post; $post->addCategory($this); } return $this; } public function removePost(Post $post): self { if ($this->posts->removeElement($post)) { $post->removeCategory($this); } return $this; } }