src/Entity/Section.php line 12

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\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. #[ORM\Entity(repositoryClassSectionRepository::class)]
  9. class Section
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column]
  14.     private ?int $id null;
  15.     #[ORM\Column(length255)]
  16.     private ?string $titre null;
  17.     #[ORM\Column]
  18.     private ?int $ordre null;
  19.     #[ORM\Column]
  20.     private ?bool $actif true;
  21.     #[ORM\OneToMany(mappedBy'section'targetEntityRubrique::class, cascade: ['remove''persist'])]
  22.     private Collection $rubriques;
  23.     #[ORM\ManyToOne(inversedBy'sections')]
  24.     private ?Document $document null;
  25.     #[ORM\ManyToOne(targetEntityself::class, inversedBy'subSections')]
  26.     private ?self $parentSection null;
  27.     #[ORM\OneToMany(mappedBy'parentSection'targetEntityself::class, cascade: ['remove''persist'])]
  28.     private Collection $subSections;
  29.     #[ORM\OneToMany(mappedBy'section'targetEntityElement::class)]
  30.     private Collection $elements;
  31.     #[ORM\OneToMany(mappedBy'section'targetEntityBloc::class, cascade: ['remove''persist'] )]
  32.     private Collection $bloc;
  33.     public function __construct()
  34.     {
  35.         $this->rubriques = new ArrayCollection();
  36.         $this->subSections = new ArrayCollection();
  37.         $this->elements = new ArrayCollection();
  38.         $this->bloc = new ArrayCollection();
  39.     }
  40.     public function getId(): ?int
  41.     {
  42.         return $this->id;
  43.     }
  44.     public function getTitre(): ?string
  45.     {
  46.         return $this->titre;
  47.     }
  48.     public function setTitre(string $titre): static
  49.     {
  50.         $this->titre $titre;
  51.         return $this;
  52.     }
  53.     public function getOrdre(): ?int
  54.     {
  55.         return $this->ordre;
  56.     }
  57.     public function setOrdre(int $ordre): static
  58.     {
  59.         $this->ordre $ordre;
  60.         return $this;
  61.     }
  62.     public function isActif(): ?bool
  63.     {
  64.         return $this->actif;
  65.     }
  66.     public function setActif(bool $actif): static
  67.     {
  68.         $this->actif $actif;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, Rubrique>
  73.      */
  74.     public function getRubriques(): Collection
  75.     {
  76.         return $this->rubriques;
  77.     }
  78.     public function addRubrique(Rubrique $rubrique): static
  79.     {
  80.         if (!$this->rubriques->contains($rubrique)) {
  81.             $this->rubriques->add($rubrique);
  82.             $rubrique->setSection($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeRubrique(Rubrique $rubrique): static
  87.     {
  88.         if ($this->rubriques->removeElement($rubrique)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($rubrique->getSection() === $this) {
  91.                 $rubrique->setSection(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96.     public function getDocument(): ?Document
  97.     {
  98.         return $this->document;
  99.     }
  100.     public function setDocument(?Document $document): static
  101.     {
  102.         $this->document $document;
  103.         return $this;
  104.     }
  105.     public function getParentSection(): ?self
  106.     {
  107.         return $this->parentSection;
  108.     }
  109.     public function setParentSection(?self $parentSection): static
  110.     {
  111.         $this->parentSection $parentSection;
  112.         return $this;
  113.     }
  114.     /**
  115.      * @return Collection<int, self>
  116.      */
  117.     public function getSubSections(): Collection
  118.     {
  119.         return $this->subSections;
  120.     }
  121.     public function addSubSection(self $subSection): static
  122.     {
  123.         if (!$this->subSections->contains($subSection)) {
  124.             $this->subSections->add($subSection);
  125.             $subSection->setParentSection($this);
  126.         }
  127.         return $this;
  128.     }
  129.     public function removeSubSection(self $subSection): static
  130.     {
  131.         if ($this->subSections->removeElement($subSection)) {
  132.             // set the owning side to null (unless already changed)
  133.             if ($subSection->getParentSection() === $this) {
  134.                 $subSection->setParentSection(null);
  135.             }
  136.         }
  137.         return $this;
  138.     }
  139.     /**
  140.      * @return Collection<int, Element>
  141.      */
  142.     public function getElements(): Collection
  143.     {
  144.         return $this->elements;
  145.     }
  146.     public function addElement(Element $element): static
  147.     {
  148.         if (!$this->elements->contains($element)) {
  149.             $this->elements->add($element);
  150.             $element->setSection($this);
  151.         }
  152.         return $this;
  153.     }
  154.     public function removeElement(Element $element): static
  155.     {
  156.         if ($this->elements->removeElement($element)) {
  157.             // set the owning side to null (unless already changed)
  158.             if ($element->getSection() === $this) {
  159.                 $element->setSection(null);
  160.             }
  161.         }
  162.         return $this;
  163.     }
  164.     /**
  165.      * @return Collection<int, Bloc>
  166.      */
  167.     public function getBloc(): Collection
  168.     {
  169.         return $this->bloc;
  170.     }
  171.     public function addBloc(Bloc $bloc): static
  172.     {
  173.         if (!$this->bloc->contains($bloc)) {
  174.             $this->bloc->add($bloc);
  175.             $bloc->setSection($this);
  176.         }
  177.         return $this;
  178.     }
  179.     public function removeBloc(Bloc $bloc): static
  180.     {
  181.         if ($this->bloc->removeElement($bloc)) {
  182.             // set the owning side to null (unless already changed)
  183.             if ($bloc->getSection() === $this) {
  184.                 $bloc->setSection(null);
  185.             }
  186.         }
  187.         return $this;
  188.     }
  189. }