src/Entity/Section.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\SectionRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassSectionRepository::class)]
  8. class Section
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length255)]
  15.     private ?string $titre null;
  16.     #[ORM\Column]
  17.     private ?int $ordre null;
  18.     #[ORM\Column]
  19.     private ?bool $actif true;
  20.     #[ORM\ManyToOne(inversedBy'sections')]
  21.     private ?Document $document null;
  22.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'subSections')]
  23.     private ?self $parentSection null;
  24.     #[ORM\OneToMany(mappedBy'parentSection'targetEntityself::class, cascade: ['remove''persist'])]
  25.     private Collection $subSections;
  26.     #[ORM\OneToMany(mappedBy'section'targetEntityBloc::class, cascade: ['remove''persist'] )]
  27.     private Collection $bloc;
  28.     public function __construct()
  29.     {
  30.         $this->subSections = new ArrayCollection();
  31.         $this->bloc = new ArrayCollection();
  32.     }
  33.     public function getId(): ?int
  34.     {
  35.         return $this->id;
  36.     }
  37.     public function getTitre(): ?string
  38.     {
  39.         return $this->titre;
  40.     }
  41.     public function setTitre(string $titre): static
  42.     {
  43.         $this->titre $titre;
  44.         return $this;
  45.     }
  46.     public function getOrdre(): ?int
  47.     {
  48.         return $this->ordre;
  49.     }
  50.     public function setOrdre(int $ordre): static
  51.     {
  52.         $this->ordre $ordre;
  53.         return $this;
  54.     }
  55.     public function isActif(): ?bool
  56.     {
  57.         return $this->actif;
  58.     }
  59.     public function setActif(bool $actif): static
  60.     {
  61.         $this->actif $actif;
  62.         return $this;
  63.     }
  64.     public function getDocument(): ?Document
  65.     {
  66.         return $this->document;
  67.     }
  68.     public function setDocument(?Document $document): static
  69.     {
  70.         $this->document $document;
  71.         return $this;
  72.     }
  73.     public function getParentSection(): ?self
  74.     {
  75.         return $this->parentSection;
  76.     }
  77.     public function setParentSection(?self $parentSection): static
  78.     {
  79.         $this->parentSection $parentSection;
  80.         return $this;
  81.     }
  82.     /**
  83.      * @return Collection<int, self>
  84.      */
  85.     public function getSubSections(): Collection
  86.     {
  87.         return $this->subSections;
  88.     }
  89.     public function addSubSection(self $subSection): static
  90.     {
  91.         if (!$this->subSections->contains($subSection)) {
  92.             $this->subSections->add($subSection);
  93.             $subSection->setParentSection($this);
  94.         }
  95.         return $this;
  96.     }
  97.     public function removeSubSection(self $subSection): static
  98.     {
  99.         if ($this->subSections->removeElement($subSection)) {
  100.             // set the owning side to null (unless already changed)
  101.             if ($subSection->getParentSection() === $this) {
  102.                 $subSection->setParentSection(null);
  103.             }
  104.         }
  105.         return $this;
  106.     }
  107.     /**
  108.      * @return Collection<int, Bloc>
  109.      */
  110.     public function getBloc(): Collection
  111.     {
  112.         return $this->bloc;
  113.     }
  114.     public function addBloc(Bloc $bloc): static
  115.     {
  116.         if (!$this->bloc->contains($bloc)) {
  117.             $this->bloc->add($bloc);
  118.             $bloc->setSection($this);
  119.         }
  120.         return $this;
  121.     }
  122.     public function removeBloc(Bloc $bloc): static
  123.     {
  124.         if ($this->bloc->removeElement($bloc)) {
  125.             // set the owning side to null (unless already changed)
  126.             if ($bloc->getSection() === $this) {
  127.                 $bloc->setSection(null);
  128.             }
  129.         }
  130.         return $this;
  131.     }
  132. }