<?phpnamespace App\Entity;use App\Repository\SectionRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\ORM\Mapping as ORM;/** * @ORM\Entity(repositoryClass=SectionRepository::class) */class Section{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=100) */ private $label; /** * @ORM\Column(type="boolean") */ private $is_active; /** * @ORM\OneToMany(targetEntity=Article::class, mappedBy="section", orphanRemoval=true) */ private $articles; /** * @ORM\OneToMany(targetEntity=Category::class, mappedBy="section", orphanRemoval=true) */ private $categories; public function __construct() { $this->articles = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getLabel(): ?string { return $this->label; } public function setLabel(string $label): self { $this->label = $label; return $this; } public function isIsActive(): ?bool { return $this->is_active; } public function setIsActive(bool $is_active): self { $this->is_active = $is_active; return $this; } /** * @return Collection<int, Article> */ public function getArticles(): Collection { return $this->articles; } public function addArticle(Article $article): self { if (!$this->articles->contains($article)) { $this->articles[] = $article; $article->setSection($this); } return $this; } public function removeArticle(Article $article): self { if ($this->articles->removeElement($article)) { // set the owning side to null (unless already changed) if ($article->getSection() === $this) { $article->setSection(null); } } return $this; } /** * @return Collection<int, Category> */ public function getCategories(): Collection { return $this->categories; } public function addCategory(Category $category): self { if (!$this->categories->contains($category)) { $this->categories[] = $category; $category->setSection($this); } return $this; } public function removeCategory(Category $category): self { if ($this->categories->removeElement($category)) { // set the owning side to null (unless already changed) if ($category->getSection() === $this) { $category->setSection(null); } } return $this; }}