<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
#[ORM\Entity(repositoryClass: \App\Repository\StatutRepository::class)]
class Statut implements \Stringable
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private int $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $name= null;
#[ORM\OneToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'status')]
private mixed $posts;
#[ORM\OneToMany(targetEntity: \App\Entity\Post::class, mappedBy: 'old_status')]
private mixed $oldposts;
#[ORM\OneToMany(targetEntity: Document::class, mappedBy: 'statut')]
private mixed $documents;
#[ORM\OneToMany(targetEntity: PolitiqueDepartementale::class, mappedBy: 'statut')]
private mixed $politiqueDepartementales;
#[ORM\OneToMany(targetEntity: Service::class, mappedBy: 'statut')]
private mixed $services;
#[ORM\OneToMany(mappedBy: 'statut', targetEntity: PageSatellite::class)]
private Collection $pageSatellites;
public function __construct()
{
$this->posts = new ArrayCollection();
$this->oldposts = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->politiqueDepartementales = new ArrayCollection();
$this->services = new ArrayCollection();
$this->pageSatellites = 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|Post[]
*/
public function getPosts(): Collection
{
return $this->posts;
}
public function addPost(Post $post): self
{
if (!$this->posts->contains($post)) {
$this->posts[] = $post;
$post->setStatus($this);
}
return $this;
}
public function removePost(Post $post): self
{
if ($this->posts->contains($post)) {
$this->posts->removeElement($post);
// set the owning side to null (unless already changed)
if ($post->getStatus() === $this) {
$post->setStatus(null);
}
}
return $this;
}
public function __toString(): string
{
return (string) $this->name;
}
/**
* @return Collection|Post[]
*/
public function getOldposts(): Collection
{
return $this->oldposts;
}
public function addOldpost(Post $oldpost): self
{
if (!$this->oldposts->contains($oldpost)) {
$this->oldposts[] = $oldpost;
$oldpost->setOldStatus($this);
}
return $this;
}
public function removeOldpost(Post $oldpost): self
{
if ($this->oldposts->contains($oldpost)) {
$this->oldposts->removeElement($oldpost);
// set the owning side to null (unless already changed)
if ($oldpost->getOldStatus() === $this) {
$oldpost->setOldStatus(null);
}
}
return $this;
}
/**
* @return Collection|Document[]
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setStatut($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getStatut() === $this) {
$document->setStatut(null);
}
}
return $this;
}
/**
* @return Collection|PolitiqueDepartementale[]
*/
public function getPolitiqueDepartementales(): Collection
{
return $this->politiqueDepartementales;
}
public function addPolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
{
if (!$this->politiqueDepartementales->contains($politiqueDepartementale)) {
$this->politiqueDepartementales[] = $politiqueDepartementale;
$politiqueDepartementale->setStatut($this);
}
return $this;
}
public function removePolitiqueDepartementale(PolitiqueDepartementale $politiqueDepartementale): self
{
if ($this->politiqueDepartementales->removeElement($politiqueDepartementale)) {
// set the owning side to null (unless already changed)
if ($politiqueDepartementale->getStatut() === $this) {
$politiqueDepartementale->setStatut(null);
}
}
return $this;
}
/**
* @return Collection|Service[]
*/
public function getServices(): Collection
{
return $this->services;
}
public function addService(Service $service): self
{
if (!$this->services->contains($service)) {
$this->services[] = $service;
$service->setStatut($this);
}
return $this;
}
public function removeService(Service $service): self
{
if ($this->services->removeElement($service)) {
// set the owning side to null (unless already changed)
if ($service->getStatut() === $this) {
$service->setStatut(null);
}
}
return $this;
}
/**
* @return Collection<int, PageSatellite>
*/
public function getPageSatellites(): Collection
{
return $this->pageSatellites;
}
public function addPageSatellite(PageSatellite $pageSatellite): self
{
if (!$this->pageSatellites->contains($pageSatellite)) {
$this->pageSatellites->add($pageSatellite);
$pageSatellite->setStatut($this);
}
return $this;
}
public function removePageSatellite(PageSatellite $pageSatellite): self
{
if ($this->pageSatellites->removeElement($pageSatellite)) {
// set the owning side to null (unless already changed)
if ($pageSatellite->getStatut() === $this) {
$pageSatellite->setStatut(null);
}
}
return $this;
}
}