<?phpnamespace App\Entity;use App\Entity\Category;use Doctrine\ORM\Mapping as ORM;use App\Repository\SubCategoryRepository;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;#[ORM\Entity(repositoryClass: SubCategoryRepository::class)]class SubCategory{ #[ORM\Id] #[ORM\GeneratedValue] #[ORM\Column] private ?int $id = null; #[ORM\Column(length: 255)] private ?string $name = null; #[ORM\Column(length: 255)] private ?string $slug = null; #[ORM\ManyToOne(inversedBy: 'subCategories')] private ?Category $mainCategory = null; #[ORM\OneToMany(targetEntity: Page::class,mappedBy: 'subCategory')] private Collection $pages; public function __construct() { $this->pages = new ArrayCollection(); } public function __toString() { return $this->name; } public function getId(): ?int { return $this->id; } public function getMainCategory(): ?Category { return $this->mainCategory; } public function setMainCategory(?Category $mainCategory): static { $this->mainCategory = $mainCategory; return $this; } /** * Get the value of name */ public function getName() { return $this->name; } /** * Set the value of name * * @return self */ public function setName($name) { $this->name = $name; return $this; } /** * Get the value of slug */ public function getSlug() { return $this->slug; } /** * Set the value of slug * * @return self */ public function setSlug($slug) { $this->slug = $slug; return $this; } /** * Get the value of pages */ public function getPages() { return $this->pages; } /** * Set the value of pages * * @return self */ public function setPages($pages) { $this->pages = $pages; return $this; }}