<?phpnamespace App\Entity;use App\Repository\ThematiqueRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=ThematiqueRepository::class) */class Thematique{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column */ private ?int $id = null; /** * @ORM\Column(length=255, unique=true) */ private ?string $name = null; /** * @ORM\Column(length=255, unique=true) */ private ?string $slug = null; public function getSlug(): ?string { return $this->slug; } public function setSlug(?string $slug): void { $this->slug = $slug; } /** * @ORM\ManyToMany(targetEntity=Blog::class, mappedBy="thematique") */ private Collection $blogs; /** * @ORM\ManyToMany(targetEntity=SousThematique::class, inversedBy="thematiques") */ private Collection $sousThematique; public function __construct() { $this->blogs = new ArrayCollection(); $this->sousThematique = 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; } /** * @return Collection<int, Blog> */ public function getBlogs(): Collection { return $this->blogs; } public function addBlog(Blog $blog): self { if (!$this->blogs->contains($blog)) { $this->blogs->add($blog); $blog->addThematique($this); } return $this; } public function removeBlog(Blog $blog): self { if ($this->blogs->removeElement($blog)) { $blog->removeThematique($this); } return $this; } /** * @return Collection<int, SousThematique> */ public function getSousThematique(): Collection { return $this->sousThematique; } public function addSousThematique(SousThematique $sousThematique): self { if (!$this->sousThematique->contains($sousThematique)) { $this->sousThematique->add($sousThematique); $sousThematique->addThematique($this); // Ajoute cette ligne pour maintenir la relation bidirectionnelle } return $this; } public function removeSousThematique(SousThematique $sousThematique): self { if ($this->sousThematique->contains($sousThematique)) { $this->sousThematique->removeElement($sousThematique); $sousThematique->removeThematique($this); // Supprime cette ligne pour maintenir la relation bidirectionnelle } return $this; }}