1])] private $isActive; #[ORM\ManyToOne(targetEntity: Category::class, inversedBy: 'categories')] private $parentCategory; #[ORM\OneToMany(targetEntity: Category::class, mappedBy: 'parentCategory')] private $categories; public function __construct() { $this->posts = new ArrayCollection(); $this->categories = 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; } public function getIsActive(): ?bool { return $this->isActive; } public function setIsActive(?bool $isActive): self { $this->isActive = $isActive; return $this; } public function getParentCategory(): ?self { return $this->parentCategory; } public function setParentCategory(?self $parentCategory): self { $this->parentCategory = $parentCategory; return $this; } /** * @return Collection|self[] */ public function getCategories(): Collection { return $this->categories; } public function addCategory(self $category): self { if (!$this->categories->contains($category)) { $this->categories[] = $category; $category->setParentCategory($this); } return $this; } public function removeCategory(self $category): self { if ($this->categories->removeElement($category)) { // set the owning side to null (unless already changed) if ($category->getParentCategory() === $this) { $category->setParentCategory(null); } } return $this; } }