<?php
namespace App\Entity;
use App\Repository\ProgrammeRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=ProgrammeRepository::class)
*/
class Programme
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\OneToMany(targetEntity=Lot::class, mappedBy="programmeParent", cascade={"remove", "persist"})
*/
private $lots;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $type;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $adresse;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ville;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $codePostal;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateLivraison;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $latitude;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $longitude;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $livraison;
/**
* @ORM\Column(type="boolean", options={"default":true})
*/
private $visuLivraison = true;
/**
* @ORM\Column(type="string", length=64, nullable=true)
*/
private $nom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $brochure;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $promoteur;
/**
* @ORM\Column(type="text", length=255, nullable=true)
*/
private $planMasse;
/**
* @ORM\Column(type="string", length=80, options={"default" : "satellite"})
*/
private $typePlan;
/**
* @ORM\Column(type="float", options={"default" : 16})
*/
private $zoomMap;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $libelleBrochure;
/**
* @ORM\OneToMany(targetEntity=Denonciation::class, mappedBy="programme")
*/
private $denonciations;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $demandeSuppression;
/**
* @ORM\ManyToOne(targetEntity=Entreprise::class, inversedBy="utilisateurs")
*/
private $entreprise;
/**
* @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="prescripteurProgrammes")
*/
private $prescripteur;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $noteGlobale;
/**
* @ORM\OneToMany(targetEntity=PieceJointe::class, mappedBy="programme", cascade={"persist", "remove"})
* @ORM\OrderBy({"ordre" = "ASC"})
*/
private $pjs;
/**
* @ORM\OneToMany(targetEntity=Documents::class, mappedBy="programme", cascade={"persist", "remove"})
*/
private $documents;
/**
* @ORM\OneToMany(targetEntity=InfosSuivi::class, mappedBy="programme")
*/
private $infosSuivis;
const TYPES_PLANS = [
'satellite' => 'Satellite',
'roadmap' => 'Carte'
];
const ZOOMS_MAP = [
18 => 'Très rapproché',
17 => 'Rapproché',
16 => 'Normal',
15 => 'Éloigné',
14 => 'Très éloigné'
];
public function __construct()
{
$this->pjs = new ArrayCollection();
$this->lots = new ArrayCollection();
$this->typePlan = 'satellite';
$this->zoomMap = 16;
$this->denonciations = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->infosSuivis = new ArrayCollection();
}
public function __toString() {
return trim($this->getNom()) == '' || $this->getNom() == null ? 'Un programme' : $this->getNom();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @return Collection|Lot[]
*/
public function getLots(): Collection
{
return $this->lots;
}
public function addLot(Lot $lot): self
{
if (!$this->lots->contains($lot)) {
$this->lots[] = $lot;
$lot->setProgrammeParent($this);
}
return $this;
}
public function removeLot(Lot $lot): self
{
if ($this->lots->removeElement($lot)) {
// set the owning side to null (unless already changed)
if ($lot->getProgrammeParent() === $this) {
$lot->setProgrammeParent(null);
}
}
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getAdresse(): ?string
{
return str_replace('é', 'É',
str_replace('è', 'È',
str_replace('à', 'À',
strtoupper($this->adresse)
)
)
);
}
public function setAdresse(?string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getVille(): ?string
{
return str_replace('é', 'É',
str_replace('è', 'È',
str_replace('à', 'À',
strtoupper($this->ville)
)
)
);
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getCodePostal(): ?string
{
return strtoupper($this->codePostal);
}
public function setCodePostal(?string $codePostal): self
{
$this->codePostal = $codePostal;
return $this;
}
public function getDateLivraison(): ?\DateTimeInterface
{
return $this->dateLivraison;
}
public function setDateLivraison(?\DateTimeInterface $dateLivraison): self
{
$this->dateLivraison = $dateLivraison;
return $this;
}
public function getLatitude(): ?float
{
return $this->latitude;
}
public function setLatitude(?float $latitude): self
{
$this->latitude = $latitude;
return $this;
}
public function getLongitude(): ?float
{
return $this->longitude;
}
public function setLongitude(?float $longitude): self
{
$this->longitude = $longitude;
return $this;
}
public function getLivraison(): ?string
{
return $this->livraison;
}
public function setLivraison(?string $livraison): self
{
$this->livraison = $livraison;
return $this;
}
public function getVisuLivraison(): ?bool
{
return $this->visuLivraison;
}
public function setVisuLivraison(bool $visuLivraison): self
{
$this->visuLivraison = $visuLivraison;
return $this;
}
public function getNom(): ?string
{
return str_replace('é', 'É',
str_replace('è', 'È',
str_replace('à', 'À',
strtoupper($this->nom)
)
)
);
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getBrochure(): ?string
{
return $this->brochure;
}
public function setBrochure(?string $brochure): self
{
$this->brochure = $brochure;
return $this;
}
public function getPromoteur(): ?string
{
return $this->promoteur;
}
public function setPromoteur(?string $promoteur): self
{
$this->promoteur = $promoteur;
return $this;
}
public function getPlanMasse(): ?string
{
return $this->planMasse;
}
public function setPlanMasse(?string $planMasse): self
{
$this->planMasse = $planMasse;
return $this;
}
public function getLibelleTypePlan()
{
return self::TYPES_PLANS[$this->getTypePlan()];
}
public function getTypePlan(): ?string
{
return $this->typePlan;
}
public function setTypePlan(string $typePlan): self
{
$this->typePlan = $typePlan;
return $this;
}
public function getLibelleZoomMap()
{
return self::ZOOMS_MAP[$this->getZoomMap()];
}
public function getZoomMap(): ?float
{
return $this->zoomMap;
}
public function setZoomMap(float $zoomMap): self
{
$this->zoomMap = $zoomMap;
return $this;
}
public function getLibelleBrochure(): ?string
{
return $this->libelleBrochure;
}
public function setLibelleBrochure(?string $libelleBrochure): self
{
$this->libelleBrochure = $libelleBrochure;
return $this;
}
/**
* @return Collection|Denonciation[]
*/
public function getDenonciations(): Collection
{
return $this->denonciations;
}
public function addDenonciation(Denonciation $denonciation): self
{
if (!$this->denonciations->contains($denonciation)) {
$this->denonciations[] = $denonciation;
$denonciation->setProgramme($this);
}
return $this;
}
public function removeDenonciation(Denonciation $denonciation): self
{
if ($this->denonciations->removeElement($denonciation)) {
// set the owning side to null (unless already changed)
if ($denonciation->getProgramme() === $this) {
$denonciation->setProgramme(null);
}
}
return $this;
}
public function getDemandeSuppression(): ?\DateTimeInterface
{
return $this->demandeSuppression;
}
public function setDemandeSuppression(?\DateTimeInterface $demandeSuppression): self
{
$this->demandeSuppression = $demandeSuppression;
return $this;
}
public function getEntreprise(): ?Entreprise
{
return $this->entreprise;
}
public function setEntreprise(?Entreprise $entreprise): self
{
$this->entreprise = $entreprise;
return $this;
}
public function getPrescripteur(): ?Utilisateur
{
return $this->prescripteur;
}
public function setPrescripteur(?Utilisateur $prescripteur): self
{
$this->prescripteur = $prescripteur;
return $this;
}
public function getNoteGlobale(): ?string
{
return html_entity_decode(strip_tags($this->noteGlobale));
}
public function setNoteGlobale(?string $noteGlobale): self
{
$this->noteGlobale = $noteGlobale;
return $this;
}
/**
* @return Collection|PieceJointe[]
*/
public function getPjs(): Collection
{
return $this->pjs;
}
public function addPj(PieceJointe $pj): self
{
if (!$this->pjs->contains($pj)) {
$this->pjs[] = $pj;
$pj->setProgramme($this);
}
return $this;
}
public function removePj(PieceJointe $pj): self
{
if ($this->pjs->removeElement($pj)) {
if ($pj->getProgramme() === $this) {
$pj->setProgramme(null);
}
}
return $this;
}
/**
* @return Collection<int, Documents>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Documents $document): self
{
if (!$this->documents->contains($document)) {
$this->documents[] = $document;
$document->setProgramme($this);
}
return $this;
}
public function removeDocument(Documents $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getProgramme() === $this) {
$document->setProgramme(null);
}
}
return $this;
}
/**
* @return Collection<int, InfosSuivi>
*/
public function getInfosSuivis(): Collection
{
return $this->infosSuivis;
}
public function addInfosSuivi(InfosSuivi $infosSuivi): self
{
if (!$this->infosSuivis->contains($infosSuivi)) {
$this->infosSuivis[] = $infosSuivi;
$infosSuivi->setProgramme($this);
}
return $this;
}
public function removeInfosSuivi(InfosSuivi $infosSuivi): self
{
if ($this->infosSuivis->removeElement($infosSuivi)) {
// set the owning side to null (unless already changed)
if ($infosSuivi->getProgramme() === $this) {
$infosSuivi->setProgramme(null);
}
}
return $this;
}
}