<?phpnamespace App\Entity;use App\Repository\SubCategoryRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=SubCategoryRepository::class) */class SubCategory{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $name; /** * @ORM\Column(type="string", length=255, nullable=true) */ private $slug; /** * @ORM\ManyToOne(targetEntity=Category::class, inversedBy="subCategories") */ private $category; /** * @ORM\Column(type="text", nullable=true) */ private $description; /** * @ORM\OneToMany(targetEntity=ProductPage::class, mappedBy="subCategory") */ private $productPages; public function __construct() { $this->productPages = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getName(): ?string { return $this->name; } public function setName(?string $name): self { $this->name = $name; return $this; } public function getSlug(): ?string { return $this->slug; } public function setSlug(?string $slug): self { $this->slug = $slug; return $this; } public function getCategory(): ?Category { return $this->category; } public function setCategory(?Category $category): self { $this->category = $category; return $this; } public function getDescription(): ?string { return $this->description; } public function setDescription(?string $description): self { $this->description = $description; return $this; } /** * @return Collection<int, ProductPage> */ public function getProductPages(): Collection { return $this->productPages; } public function addProductPage(ProductPage $productPage): self { if (!$this->productPages->contains($productPage)) { $this->productPages[] = $productPage; $productPage->setSubCategory($this); } return $this; } public function removeProductPage(ProductPage $productPage): self { if ($this->productPages->removeElement($productPage)) { // set the owning side to null (unless already changed) if ($productPage->getSubCategory() === $this) { $productPage->setSubCategory(null); } } return $this; }}