src/Entity/Ligne.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\LigneRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Entity(repositoryClass=LigneRepository::class)
  9.  */
  10. class Ligne
  11. {
  12.     /**
  13.      * @ORM\Id
  14.      * @ORM\GeneratedValue
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $lgn_nom;
  22.     /**
  23.      * @ORM\Column(type="boolean")
  24.      */
  25.     private $lgn_actif;
  26.     /**
  27.      * @ORM\ManyToOne(targetEntity=CentreType::class, inversedBy="lignes", fetch="EAGER")
  28.      * @ORM\JoinColumn(nullable=true)
  29.      */
  30.     private $centre_type;
  31.     /**
  32.      * @ORM\OneToMany(targetEntity=LigneBlocage::class, mappedBy="ligne")
  33.      */
  34.     private $ligneBlocages;
  35.     /**
  36.      * @ORM\ManyToOne(targetEntity=CentreGroupe::class, inversedBy="lignes")
  37.      * @ORM\JoinColumn(nullable=false)
  38.      */
  39.     private $centre_groupe;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=Rendezvous::class, mappedBy="ligne")
  42.      */
  43.     private $rendezVouses;
  44.     /**
  45.      * @ORM\OneToMany(targetEntity=CentrePartenaire::class, mappedBy="ligne", orphanRemoval=true)
  46.      */
  47.     private $centrePartenaires;
  48.     /**
  49.      * @ORM\Column(type="integer", nullable=true)
  50.      */
  51.     private $id_old;
  52.     /**
  53.      * @ORM\OneToMany(targetEntity=LigneHoraire::class, mappedBy="ligne", orphanRemoval=true, fetch="EAGER")
  54.      */
  55.     private $ligneHoraires;
  56.     /**
  57.      * @ORM\ManyToMany(targetEntity=CentrePrestation::class, inversedBy="lignes")
  58.      */
  59.     private $prestations;
  60.     /**
  61.      * @ORM\Column(type="boolean", nullable=true)
  62.      */
  63.     private $lgn_vl;
  64.     /**
  65.      * @ORM\Column(type="boolean", nullable=true)
  66.      */
  67.     private $lgn_pl;
  68.     /**
  69.      * @ORM\Column(type="boolean", nullable=true)
  70.      */
  71.     private $lgn_cl;
  72.     /**
  73.      * @ORM\Column(type="string", length=15, nullable=true)
  74.      */
  75.     private $color;
  76.     public function __construct()
  77.     {
  78.         $this->ligneBlocages = new ArrayCollection();
  79.         $this->rendezVouses = new ArrayCollection();
  80.         $this->centrePartenaires = new ArrayCollection();
  81.         $this->ligneHoraires = new ArrayCollection();
  82.         $this->prestations = new ArrayCollection();
  83.     }
  84.     public function getId(): ?int
  85.     {
  86.         return $this->id;
  87.     }
  88.     public function getLgnNom(): ?string
  89.     {
  90.         return $this->lgn_nom;
  91.     }
  92.     public function setLgnNom(string $lgn_nom): self
  93.     {
  94.         $this->lgn_nom $lgn_nom;
  95.         return $this;
  96.     }
  97.     public function isLgnActif(): ?bool
  98.     {
  99.         return $this->lgn_actif;
  100.     }
  101.     public function setLgnActif(bool $lgn_actif): self
  102.     {
  103.         $this->lgn_actif $lgn_actif;
  104.         return $this;
  105.     }
  106.     public function getCentreType(): ?CentreType
  107.     {
  108.         return $this->centre_type;
  109.     }
  110.     public function setCentreType(?CentreType $centre_type): self
  111.     {
  112.         $this->centre_type $centre_type;
  113.         return $this;
  114.     }
  115.     /**
  116.      * @return Collection<int, LigneBlocage>
  117.      */
  118.     public function getLigneBlocages(): Collection
  119.     {
  120.         return $this->ligneBlocages;
  121.     }
  122.     public function addLigneBlocage(LigneBlocage $ligneBlocage): self
  123.     {
  124.         if (!$this->ligneBlocages->contains($ligneBlocage)) {
  125.             $this->ligneBlocages[] = $ligneBlocage;
  126.             $ligneBlocage->setLigne($this);
  127.         }
  128.         return $this;
  129.     }
  130.     public function removeLigneBlocage(LigneBlocage $ligneBlocage): self
  131.     {
  132.         if ($this->ligneBlocages->removeElement($ligneBlocage)) {
  133.             // set the owning side to null (unless already changed)
  134.             if ($ligneBlocage->getLigne() === $this) {
  135.                 $ligneBlocage->setLigne(null);
  136.             }
  137.         }
  138.         return $this;
  139.     }
  140.     public function getCentreGroupe(): ?CentreGroupe
  141.     {
  142.         return $this->centre_groupe;
  143.     }
  144.     public function setCentreGroupe(?CentreGroupe $centre_groupe): self
  145.     {
  146.         $this->centre_groupe $centre_groupe;
  147.         return $this;
  148.     }
  149.     /**
  150.      * @return Collection<int, Rendezvous>
  151.      */
  152.     public function getRendezVouses(): Collection
  153.     {
  154.         return $this->rendezVouses;
  155.     }
  156.     public function addRendezVouse(Rendezvous $rendezVouse): self
  157.     {
  158.         if (!$this->rendezVouses->contains($rendezVouse)) {
  159.             $this->rendezVouses[] = $rendezVouse;
  160.             $rendezVouse->setLigne($this);
  161.         }
  162.         return $this;
  163.     }
  164.     public function removeRendezVouse(Rendezvous $rendezVouse): self
  165.     {
  166.         if ($this->rendezVouses->removeElement($rendezVouse)) {
  167.             // set the owning side to null (unless already changed)
  168.             if ($rendezVouse->getLigne() === $this) {
  169.                 $rendezVouse->setLigne(null);
  170.             }
  171.         }
  172.         return $this;
  173.     }
  174.     /**
  175.      * @return Collection<int, CentrePartenaire>
  176.      */
  177.     public function getCentrePartenaires(): Collection
  178.     {
  179.         return $this->centrePartenaires;
  180.     }
  181.     public function addCentrePartenaire(CentrePartenaire $centrePartenaire): self
  182.     {
  183.         if (!$this->centrePartenaires->contains($centrePartenaire)) {
  184.             $this->centrePartenaires[] = $centrePartenaire;
  185.             $centrePartenaire->setLigne($this);
  186.         }
  187.         return $this;
  188.     }
  189.     public function removeCentrePartenaire(CentrePartenaire $centrePartenaire): self
  190.     {
  191.         if ($this->centrePartenaires->removeElement($centrePartenaire)) {
  192.             // set the owning side to null (unless already changed)
  193.             if ($centrePartenaire->getLigne() === $this) {
  194.                 $centrePartenaire->setLigne(null);
  195.             }
  196.         }
  197.         return $this;
  198.     }
  199.     public function getIdOld(): ?int
  200.     {
  201.         return $this->id_old;
  202.     }
  203.     public function setIdOld(int $id_old): self
  204.     {
  205.         $this->id_old $id_old;
  206.         return $this;
  207.     }
  208.     /**
  209.      * @return Collection<int, LigneHoraire>
  210.      */
  211.     public function getLigneHoraires(): Collection
  212.     {
  213.         return $this->ligneHoraires;
  214.     }
  215.      public function getFormatLigneHoraire()
  216.     {
  217.         $groupesHoraireLigne = array();
  218.         foreach ($this->ligneHoraires as $numero => $demijournee) {
  219.             if (!array_key_exists($demijournee->getLgnHorListeJours(), $groupesHoraireLigne)) $groupesHoraireLigne[$demijournee->getLgnHorListeJours()] = array();
  220.             $groupesHoraireLigne[$demijournee->getLgnHorListeJours()][($numero == 'am' 'pm')] = array(
  221.                 'ouverture' => $demijournee->isLgnHorOuvert() ? $demijournee->getLgnHorDebut()->format('Hi') : "",
  222.                 'fermeture' => $demijournee->isLgnHorOuvert() ? $demijournee->getLgnHorFin()->format('Hi') : "",
  223.             );
  224.         }
  225.         return $groupesHoraireLigne;
  226.     }
  227.     public function addLigneHoraire(LigneHoraire $ligneHoraire): self
  228.     {
  229.         if (!$this->ligneHoraires->contains($ligneHoraire)) {
  230.             $this->ligneHoraires[] = $ligneHoraire;
  231.             $ligneHoraire->setLigne($this);
  232.         }
  233.         return $this;
  234.     }
  235.     public function removeLigneHoraire(LigneHoraire $ligneHoraire): self
  236.     {
  237.         if ($this->ligneHoraires->removeElement($ligneHoraire)) {
  238.             // set the owning side to null (unless already changed)
  239.             if ($ligneHoraire->getLigne() === $this) {
  240.                 $ligneHoraire->setLigne(null);
  241.             }
  242.         }
  243.         return $this;
  244.     }
  245.     /**
  246.      * @return Collection<int, CentrePrestation>
  247.      */
  248.     public function getPrestations(): Collection
  249.     {
  250.         return $this->prestations;
  251.     }
  252.     public function addPrestation(CentrePrestation $prestation): self
  253.     {
  254.         if (!$this->prestations->contains($prestation)) {
  255.             $this->prestations[] = $prestation;
  256.         }
  257.         return $this;
  258.     }
  259.     public function removePrestation(CentrePrestation $prestation): self
  260.     {
  261.         $this->prestations->removeElement($prestation);
  262.         return $this;
  263.     }
  264.     public function isLgnVl(): ?bool
  265.     {
  266.         return $this->lgn_vl;
  267.     }
  268.     public function setLgnVl(?bool $lgn_vl): self
  269.     {
  270.         $this->lgn_vl $lgn_vl;
  271.         return $this;
  272.     }
  273.     public function isLgnPl(): ?bool
  274.     {
  275.         return $this->lgn_pl;
  276.     }
  277.     public function setLgnPl(?bool $lgn_pl): self
  278.     {
  279.         $this->lgn_pl $lgn_pl;
  280.         return $this;
  281.     }
  282.     public function isLgnCl(): ?bool
  283.     {
  284.         return $this->lgn_cl;
  285.     }
  286.     public function setLgnCl(?bool $lgn_cl): self
  287.     {
  288.         $this->lgn_cl $lgn_cl;
  289.         return $this;
  290.     }
  291.     public function getColor(): ?string
  292.     {
  293.         return $this->color;
  294.     }
  295.     public function setColor(?string $color): self
  296.     {
  297.         $this->color $color;
  298.         return $this;
  299.     }
  300. }