src/Entity/Statut.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClass\App\Repository\StatutRepository::class)]
  7. class Statut implements \Stringable
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private int $id;
  13.     #[ORM\Column(type'string'length255nullabletrue)]
  14.     private ?string $namenull;
  15.     #[ORM\OneToMany(targetEntity\App\Entity\Post::class, mappedBy'status')]
  16.     private mixed $posts;
  17.     #[ORM\OneToMany(targetEntity\App\Entity\Post::class, mappedBy'old_status')]
  18.     private mixed $oldposts;
  19.     #[ORM\OneToMany(targetEntityDocument::class, mappedBy'statut')]
  20.     private mixed $documents;
  21.     #[ORM\OneToMany(targetEntityPolitiqueDepartementale::class, mappedBy'statut')]
  22.     private mixed $politiqueDepartementales;
  23.     #[ORM\OneToMany(targetEntityService::class, mappedBy'statut')]
  24.     private mixed $services;
  25.     #[ORM\OneToMany(mappedBy'statut'targetEntityPageSatellite::class)]
  26.     private Collection $pageSatellites;
  27.     public function __construct()
  28.     {
  29.         $this->posts = new ArrayCollection();
  30.         $this->oldposts = new ArrayCollection();
  31.         $this->documents = new ArrayCollection();
  32.         $this->politiqueDepartementales = new ArrayCollection();
  33.         $this->services = new ArrayCollection();
  34.         $this->pageSatellites = new ArrayCollection();
  35.     }
  36.     public function getId(): ?int
  37.     {
  38.         return $this->id;
  39.     }
  40.     public function getName(): ?string
  41.     {
  42.         return $this->name;
  43.     }
  44.     public function setName(?string $name): self
  45.     {
  46.         $this->name $name;
  47.         return $this;
  48.     }
  49.     /**
  50.      * @return Collection|Post[]
  51.      */
  52.     public function getPosts(): Collection
  53.     {
  54.         return $this->posts;
  55.     }
  56.     public function addPost(Post $post): self
  57.     {
  58.         if (!$this->posts->contains($post)) {
  59.             $this->posts[] = $post;
  60.             $post->setStatus($this);
  61.         }
  62.         return $this;
  63.     }
  64.     public function removePost(Post $post): self
  65.     {
  66.         if ($this->posts->contains($post)) {
  67.             $this->posts->removeElement($post);
  68.             // set the owning side to null (unless already changed)
  69.             if ($post->getStatus() === $this) {
  70.                 $post->setStatus(null);
  71.             }
  72.         }
  73.         return $this;
  74.     }
  75.     public function __toString(): string
  76.     {
  77.         return (string) $this->name;
  78.     }
  79.     /**
  80.      * @return Collection|Post[]
  81.      */
  82.     public function getOldposts(): Collection
  83.     {
  84.         return $this->oldposts;
  85.     }
  86.     public function addOldpost(Post $oldpost): self
  87.     {
  88.         if (!$this->oldposts->contains($oldpost)) {
  89.             $this->oldposts[] = $oldpost;
  90.             $oldpost->setOldStatus($this);
  91.         }
  92.         return $this;
  93.     }
  94.     public function removeOldpost(Post $oldpost): self
  95.     {
  96.         if ($this->oldposts->contains($oldpost)) {
  97.             $this->oldposts->removeElement($oldpost);
  98.             // set the owning side to null (unless already changed)
  99.             if ($oldpost->getOldStatus() === $this) {
  100.                 $oldpost->setOldStatus(null);
  101.             }
  102.         }
  103.         return $this;
  104.     }
  105.     /**
  106.      * @return Collection|Document[]
  107.      */
  108.     public function getDocuments(): Collection
  109.     {
  110.         return $this->documents;
  111.     }
  112.     public function addDocument(Document $document): self
  113.     {
  114.         if (!$this->documents->contains($document)) {
  115.             $this->documents[] = $document;
  116.             $document->setStatut($this);
  117.         }
  118.         return $this;
  119.     }
  120.     public function removeDocument(Document $document): self
  121.     {
  122.         if ($this->documents->removeElement($document)) {
  123.             // set the owning side to null (unless already changed)
  124.             if ($document->getStatut() === $this) {
  125.                 $document->setStatut(null);
  126.             }
  127.         }
  128.         return $this;
  129.     }
  130.     /**
  131.      * @return Collection|PolitiqueDepartementale[]
  132.      */
  133.     public function getPolitiqueDepartementales(): Collection
  134.     {
  135.         return $this->politiqueDepartementales;
  136.     }
  137.     public function addPolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
  138.     {
  139.         if (!$this->politiqueDepartementales->contains($politiqueDepartementale)) {
  140.             $this->politiqueDepartementales[] = $politiqueDepartementale;
  141.             $politiqueDepartementale->setStatut($this);
  142.         }
  143.         return $this;
  144.     }
  145.     public function removePolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
  146.     {
  147.         if ($this->politiqueDepartementales->removeElement($politiqueDepartementale)) {
  148.             // set the owning side to null (unless already changed)
  149.             if ($politiqueDepartementale->getStatut() === $this) {
  150.                 $politiqueDepartementale->setStatut(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155.     /**
  156.      * @return Collection|Service[]
  157.      */
  158.     public function getServices(): Collection
  159.     {
  160.         return $this->services;
  161.     }
  162.     public function addService(Service $service): self
  163.     {
  164.         if (!$this->services->contains($service)) {
  165.             $this->services[] = $service;
  166.             $service->setStatut($this);
  167.         }
  168.         return $this;
  169.     }
  170.     public function removeService(Service $service): self
  171.     {
  172.         if ($this->services->removeElement($service)) {
  173.             // set the owning side to null (unless already changed)
  174.             if ($service->getStatut() === $this) {
  175.                 $service->setStatut(null);
  176.             }
  177.         }
  178.         return $this;
  179.     }
  180.     /**
  181.      * @return Collection<int, PageSatellite>
  182.      */
  183.     public function getPageSatellites(): Collection
  184.     {
  185.         return $this->pageSatellites;
  186.     }
  187.     public function addPageSatellite(PageSatellite $pageSatellite): self
  188.     {
  189.         if (!$this->pageSatellites->contains($pageSatellite)) {
  190.             $this->pageSatellites->add($pageSatellite);
  191.             $pageSatellite->setStatut($this);
  192.         }
  193.         return $this;
  194.     }
  195.     public function removePageSatellite(PageSatellite $pageSatellite): self
  196.     {
  197.         if ($this->pageSatellites->removeElement($pageSatellite)) {
  198.             // set the owning side to null (unless already changed)
  199.             if ($pageSatellite->getStatut() === $this) {
  200.                 $pageSatellite->setStatut(null);
  201.             }
  202.         }
  203.         return $this;
  204.     }
  205. }