src/Entity/Programme.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProgrammeRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=ProgrammeRepository::class)
  9.  */
  10. class Programme
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\OneToMany(targetEntity=Lot::class, mappedBy="programmeParent", cascade={"remove", "persist"})
  20.      */
  21.     private $lots;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $type;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $adresse;
  30.     /**
  31.      * @ORM\Column(type="string", length=255, nullable=true)
  32.      */
  33.     private $ville;
  34.     /**
  35.      * @ORM\Column(type="string", length=10, nullable=true)
  36.      */
  37.     private $codePostal;
  38.     /**
  39.      * @ORM\Column(type="datetime", nullable=true)
  40.      */
  41.     private $dateLivraison;
  42.     /**
  43.      * @ORM\Column(type="float", nullable=true)
  44.      */
  45.     private $latitude;
  46.     /**
  47.      * @ORM\Column(type="float", nullable=true)
  48.      */
  49.     private $longitude;
  50.     /**
  51.      * @ORM\Column(type="string", length=64, nullable=true)
  52.      */
  53.     private $livraison;
  54.     /**
  55.      * @ORM\Column(type="boolean", options={"default":true})
  56.      */
  57.     private $visuLivraison true;
  58.     /**
  59.      * @ORM\Column(type="string", length=64, nullable=true)
  60.      */
  61.     private $nom;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $image;
  66.     /**
  67.      * @ORM\Column(type="string", length=255, nullable=true)
  68.      */
  69.     private $brochure;
  70.     /**
  71.      * @ORM\Column(type="string", length=255, nullable=true)
  72.      */
  73.     private $promoteur;
  74.     /**
  75.      * @ORM\Column(type="text", length=255, nullable=true)
  76.      */
  77.     private $planMasse;
  78.     /**
  79.      * @ORM\Column(type="string", length=80, options={"default" : "satellite"})
  80.      */
  81.     private $typePlan;
  82.     /**
  83.      * @ORM\Column(type="float", options={"default" : 16})
  84.      */
  85.     private $zoomMap;
  86.     /**
  87.      * @ORM\Column(type="string", length=255, nullable=true)
  88.      */
  89.     private $libelleBrochure;
  90.     /**
  91.      * @ORM\OneToMany(targetEntity=Denonciation::class, mappedBy="programme")
  92.      */
  93.     private $denonciations;
  94.     /**
  95.      * @ORM\Column(type="datetime", nullable=true)
  96.      */
  97.     private $demandeSuppression;
  98.     /**
  99.      * @ORM\ManyToOne(targetEntity=Entreprise::class, inversedBy="utilisateurs")
  100.      */
  101.     private $entreprise;
  102.     /**
  103.      * @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="prescripteurProgrammes")
  104.      */
  105.     private $prescripteur;
  106.     /**
  107.      * @ORM\Column(type="text", nullable=true)
  108.      */
  109.     private $noteGlobale;
  110.     /**
  111.      * @ORM\OneToMany(targetEntity=PieceJointe::class, mappedBy="programme", cascade={"persist", "remove"})
  112.      * @ORM\OrderBy({"ordre" = "ASC"})
  113.      */
  114.     private $pjs;
  115.     /**
  116.      * @ORM\OneToMany(targetEntity=Documents::class, mappedBy="programme", cascade={"persist", "remove"})
  117.      */
  118.     private $documents;
  119.     /**
  120.      * @ORM\OneToMany(targetEntity=InfosSuivi::class, mappedBy="programme")
  121.      */
  122.     private $infosSuivis;
  123.     const TYPES_PLANS = [
  124.         'satellite' => 'Satellite',
  125.         'roadmap' => 'Carte'
  126.     ];
  127.     const ZOOMS_MAP = [
  128.         18 => 'Très rapproché',
  129.         17 => 'Rapproché',
  130.         16 => 'Normal',
  131.         15 => 'Éloigné',
  132.         14 => 'Très éloigné'
  133.     ];
  134.     public function __construct()
  135.     {
  136.         $this->pjs = new ArrayCollection();
  137.         $this->lots = new ArrayCollection();
  138.         $this->typePlan 'satellite';
  139.         $this->zoomMap 16;
  140.         $this->denonciations = new ArrayCollection();
  141.         $this->documents = new ArrayCollection();
  142.         $this->infosSuivis = new ArrayCollection();
  143.     }
  144.     public function __toString() {
  145.         return trim($this->getNom()) == '' || $this->getNom() == null 'Un programme' $this->getNom();
  146.     }
  147.     public function getId(): ?int
  148.     {
  149.         return $this->id;
  150.     }
  151.     /**
  152.      * @return Collection|Lot[]
  153.      */
  154.     public function getLots(): Collection
  155.     {
  156.         return $this->lots;
  157.     }
  158.     public function addLot(Lot $lot): self
  159.     {
  160.         if (!$this->lots->contains($lot)) {
  161.             $this->lots[] = $lot;
  162.             $lot->setProgrammeParent($this);
  163.         }
  164.         return $this;
  165.     }
  166.     public function removeLot(Lot $lot): self
  167.     {
  168.         if ($this->lots->removeElement($lot)) {
  169.             // set the owning side to null (unless already changed)
  170.             if ($lot->getProgrammeParent() === $this) {
  171.                 $lot->setProgrammeParent(null);
  172.             }
  173.         }
  174.         return $this;
  175.     }
  176.     public function getType(): ?string
  177.     {
  178.         return $this->type;
  179.     }
  180.     public function setType(?string $type): self
  181.     {
  182.         $this->type $type;
  183.         return $this;
  184.     }
  185.     public function getAdresse(): ?string
  186.     {
  187.         return str_replace('é''É',
  188.             str_replace('è''È',
  189.                 str_replace('à''À',
  190.                     strtoupper($this->adresse)
  191.                 )
  192.             )
  193.         );
  194.     }
  195.     public function setAdresse(?string $adresse): self
  196.     {
  197.         $this->adresse $adresse;
  198.         return $this;
  199.     }
  200.     public function getVille(): ?string
  201.     {
  202.         return str_replace('é''É',
  203.             str_replace('è''È',
  204.                 str_replace('à''À',
  205.                     strtoupper($this->ville)
  206.                 )
  207.             )
  208.         );
  209.     }
  210.     public function setVille(?string $ville): self
  211.     {
  212.         $this->ville $ville;
  213.         return $this;
  214.     }
  215.     public function getCodePostal(): ?string
  216.     {
  217.         return strtoupper($this->codePostal);
  218.     }
  219.     public function setCodePostal(?string $codePostal): self
  220.     {
  221.         $this->codePostal $codePostal;
  222.         return $this;
  223.     }
  224.     public function getDateLivraison(): ?\DateTimeInterface
  225.     {
  226.         return $this->dateLivraison;
  227.     }
  228.     public function setDateLivraison(?\DateTimeInterface $dateLivraison): self
  229.     {
  230.         $this->dateLivraison $dateLivraison;
  231.         return $this;
  232.     }
  233.     public function getLatitude(): ?float
  234.     {
  235.         return $this->latitude;
  236.     }
  237.     public function setLatitude(?float $latitude): self
  238.     {
  239.         $this->latitude $latitude;
  240.         return $this;
  241.     }
  242.     public function getLongitude(): ?float
  243.     {
  244.         return $this->longitude;
  245.     }
  246.     public function setLongitude(?float $longitude): self
  247.     {
  248.         $this->longitude $longitude;
  249.         return $this;
  250.     }
  251.     public function getLivraison(): ?string
  252.     {
  253.         return $this->livraison;
  254.     }
  255.     public function setLivraison(?string $livraison): self
  256.     {
  257.         $this->livraison $livraison;
  258.         return $this;
  259.     }
  260.     public function getVisuLivraison(): ?bool
  261.     {
  262.         return $this->visuLivraison;
  263.     }
  264.     public function setVisuLivraison(bool $visuLivraison): self
  265.     {
  266.         $this->visuLivraison $visuLivraison;
  267.         return $this;
  268.     }
  269.     public function getNom(): ?string
  270.     {
  271.         return str_replace('é''É',
  272.             str_replace('è''È',
  273.                 str_replace('à''À',
  274.                     strtoupper($this->nom)
  275.                 )
  276.             )
  277.         );
  278.     }
  279.     public function setNom(?string $nom): self
  280.     {
  281.         $this->nom $nom;
  282.         return $this;
  283.     }
  284.     public function getImage(): ?string
  285.     {
  286.         return $this->image;
  287.     }
  288.     public function setImage(?string $image): self
  289.     {
  290.         $this->image $image;
  291.         return $this;
  292.     }
  293.     public function getBrochure(): ?string
  294.     {
  295.         return $this->brochure;
  296.     }
  297.     public function setBrochure(?string $brochure): self
  298.     {
  299.         $this->brochure $brochure;
  300.         return $this;
  301.     }
  302.     public function getPromoteur(): ?string
  303.     {
  304.         return $this->promoteur;
  305.     }
  306.     public function setPromoteur(?string $promoteur): self
  307.     {
  308.         $this->promoteur $promoteur;
  309.         return $this;
  310.     }
  311.     public function getPlanMasse(): ?string
  312.     {
  313.         return $this->planMasse;
  314.     }
  315.     public function setPlanMasse(?string $planMasse): self
  316.     {
  317.         $this->planMasse $planMasse;
  318.         return $this;
  319.     }
  320.     public function getLibelleTypePlan()
  321.     {
  322.         return self::TYPES_PLANS[$this->getTypePlan()];
  323.     }
  324.     public function getTypePlan(): ?string
  325.     {
  326.         return $this->typePlan;
  327.     }
  328.     public function setTypePlan(string $typePlan): self
  329.     {
  330.         $this->typePlan $typePlan;
  331.         return $this;
  332.     }
  333.     public function getLibelleZoomMap()
  334.     {
  335.         return self::ZOOMS_MAP[$this->getZoomMap()];
  336.     }
  337.     public function getZoomMap(): ?float
  338.     {
  339.         return $this->zoomMap;
  340.     }
  341.     public function setZoomMap(float $zoomMap): self
  342.     {
  343.         $this->zoomMap $zoomMap;
  344.         return $this;
  345.     }
  346.     public function getLibelleBrochure(): ?string
  347.     {
  348.         return $this->libelleBrochure;
  349.     }
  350.     public function setLibelleBrochure(?string $libelleBrochure): self
  351.     {
  352.         $this->libelleBrochure $libelleBrochure;
  353.         return $this;
  354.     }
  355.     /**
  356.      * @return Collection|Denonciation[]
  357.      */
  358.     public function getDenonciations(): Collection
  359.     {
  360.         return $this->denonciations;
  361.     }
  362.     public function addDenonciation(Denonciation $denonciation): self
  363.     {
  364.         if (!$this->denonciations->contains($denonciation)) {
  365.             $this->denonciations[] = $denonciation;
  366.             $denonciation->setProgramme($this);
  367.         }
  368.         return $this;
  369.     }
  370.     public function removeDenonciation(Denonciation $denonciation): self
  371.     {
  372.         if ($this->denonciations->removeElement($denonciation)) {
  373.             // set the owning side to null (unless already changed)
  374.             if ($denonciation->getProgramme() === $this) {
  375.                 $denonciation->setProgramme(null);
  376.             }
  377.         }
  378.         return $this;
  379.     }
  380.     public function getDemandeSuppression(): ?\DateTimeInterface
  381.     {
  382.         return $this->demandeSuppression;
  383.     }
  384.     public function setDemandeSuppression(?\DateTimeInterface $demandeSuppression): self
  385.     {
  386.         $this->demandeSuppression $demandeSuppression;
  387.         return $this;
  388.     }
  389.     
  390.     public function getEntreprise(): ?Entreprise
  391.     {
  392.         return $this->entreprise;
  393.     }
  394.     public function setEntreprise(?Entreprise $entreprise): self
  395.     {
  396.         $this->entreprise $entreprise;
  397.         return $this;
  398.     }
  399.     public function getPrescripteur(): ?Utilisateur
  400.     {
  401.         return $this->prescripteur;
  402.     }
  403.     public function setPrescripteur(?Utilisateur $prescripteur): self
  404.     {
  405.         $this->prescripteur $prescripteur;
  406.         return $this;
  407.     }
  408.     public function getNoteGlobale(): ?string
  409.     {
  410.         return html_entity_decode(strip_tags($this->noteGlobale));
  411.     }
  412.     public function setNoteGlobale(?string $noteGlobale): self
  413.     {
  414.         $this->noteGlobale $noteGlobale;
  415.         return $this;
  416.     }
  417.     /**
  418.      * @return Collection|PieceJointe[]
  419.      */
  420.     public function getPjs(): Collection
  421.     {
  422.         return $this->pjs;
  423.     }
  424.     public function addPj(PieceJointe $pj): self
  425.     {
  426.         if (!$this->pjs->contains($pj)) {
  427.             $this->pjs[] = $pj;
  428.             $pj->setProgramme($this);
  429.         }
  430.         return $this;
  431.     }
  432.     public function removePj(PieceJointe $pj): self
  433.     {
  434.         if ($this->pjs->removeElement($pj)) {
  435.             if ($pj->getProgramme() === $this) {
  436.                 $pj->setProgramme(null);
  437.             }
  438.         }
  439.         return $this;
  440.     }
  441.     /**
  442.      * @return Collection<int, Documents>
  443.      */
  444.     public function getDocuments(): Collection
  445.     {
  446.         return $this->documents;
  447.     }
  448.     public function addDocument(Documents $document): self
  449.     {
  450.         if (!$this->documents->contains($document)) {
  451.             $this->documents[] = $document;
  452.             $document->setProgramme($this);
  453.         }
  454.         return $this;
  455.     }
  456.     public function removeDocument(Documents $document): self
  457.     {
  458.         if ($this->documents->removeElement($document)) {
  459.             // set the owning side to null (unless already changed)
  460.             if ($document->getProgramme() === $this) {
  461.                 $document->setProgramme(null);
  462.             }
  463.         }
  464.         return $this;
  465.     }
  466.     /**
  467.      * @return Collection<int, InfosSuivi>
  468.      */
  469.     public function getInfosSuivis(): Collection
  470.     {
  471.         return $this->infosSuivis;
  472.     }
  473.     public function addInfosSuivi(InfosSuivi $infosSuivi): self
  474.     {
  475.         if (!$this->infosSuivis->contains($infosSuivi)) {
  476.             $this->infosSuivis[] = $infosSuivi;
  477.             $infosSuivi->setProgramme($this);
  478.         }
  479.         return $this;
  480.     }
  481.     public function removeInfosSuivi(InfosSuivi $infosSuivi): self
  482.     {
  483.         if ($this->infosSuivis->removeElement($infosSuivi)) {
  484.             // set the owning side to null (unless already changed)
  485.             if ($infosSuivi->getProgramme() === $this) {
  486.                 $infosSuivi->setProgramme(null);
  487.             }
  488.         }
  489.         return $this;
  490.     }
  491. }