src/Entity/Gestiform/Formations/Session/Planning/LignePrestation.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gestiform\Formations\Session\Planning;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
  5. use App\Entity\Gestiform\Users\Formateur;
  6. use App\Repository\Gestiform\Formations\Session\Planning\LignePrestationRepository;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * @ORM\Entity(repositoryClass=LignePrestationRepository::class)
  12.  */
  13. class LignePrestation extends AbstractEntity
  14. {
  15.     /**
  16.      * @ORM\Column(type="string", nullable=true)
  17.      */
  18.     private ?string $intitule null;
  19.     /**
  20.      * @ORM\Column(type="string", nullable=true)
  21.      */
  22.     private ?string $type null;
  23.     /**
  24.      * @ORM\Column(type="string", nullable=true)
  25.      */
  26.     private ?string $intituleSession null;
  27.     /**
  28.      * @ORM\Column(type="string", nullable=true)
  29.      */
  30.     private ?string $modeFormation null;
  31.     /**
  32.      * @ORM\Column(type="string", nullable=true)
  33.      */
  34.     private ?string $codeEvent null;
  35.     /**
  36.      * @ORM\Column(type="integer", nullable=true)
  37.      */
  38.     private ?int $idEvent null;
  39.     /**
  40.      * @ORM\Column(type="integer", nullable=true)
  41.      */
  42.     private ?int $duree null;
  43.     /**
  44.      * @ORM\Column(type="boolean", nullable=true)
  45.      */
  46.     private ?bool $unite false;
  47.     /**
  48.      * @ORM\Column(type="integer", nullable=true)
  49.      */
  50.     private ?int $montant null;
  51.     /**
  52.      * @ORM\Column(type="integer", nullable=true)
  53.      */
  54.     private ?int $tarif null;
  55.     /**
  56.      * @ORM\Column(type="datetime", nullable=true)
  57.      */
  58.     private ?\DateTime $start;
  59.     /**
  60.      * @ORM\Column(type="datetime", nullable=true)
  61.      */
  62.     private ?\DateTime $end null;
  63.     /**
  64.      * @ORM\ManyToOne(targetEntity=Masterlistelg::class)
  65.      */
  66.     private ?Masterlistelg $statut null;
  67.     /**
  68.      * @ORM\ManyToMany(targetEntity=Formateur::class, inversedBy="lignePrestations")
  69.      */
  70.     private Collection $formateurs;
  71.     /**
  72.      * @ORM\ManyToOne(targetEntity=Prestation::class, inversedBy="lignePrestations")
  73.      */
  74.     private ?Prestation $prestation null;
  75.     /**
  76.      * @ORM\Column(type="json", nullable=true)
  77.      */
  78.     private ?array $eventChilds null;
  79.     public function getEventChilds(): array
  80.     {
  81.         return $this->eventChilds ?? [];
  82.     }
  83.     public function addEventChild(string $idEventstring $intitule): self
  84.     {
  85.         $data $this->getEventChilds();
  86.         $exist false;
  87.         foreach ($data as &$item) {
  88.             if ($item['idEvent'] === $idEvent) {
  89.                 $item['intitule'] = $intitule;
  90.                 $exist true;
  91.                 break;
  92.             }
  93.         }
  94.         if (!$exist) {
  95.             $data[] = [
  96.                 'idEvent' => $idEvent,
  97.                 'intitule' => $intitule,
  98.             ];
  99.         }
  100.         $this->eventChilds $data;
  101.         return $this;
  102.     }
  103.     public function removeEventChild(string $idEvent): self
  104.     {
  105.         $data $this->getEventChilds();
  106.         foreach ($data as $key => $item) {
  107.             if ($item['idEvent'] === $idEvent) {
  108.                 unset($data[$key]);
  109.             }
  110.         }
  111.         $this->eventChilds array_values($data);
  112.         return $this;
  113.     }
  114.     public function clearEventChilds(): self
  115.     {
  116.         $this->eventChilds = [];
  117.         return $this;
  118.     }
  119.     public function __construct()
  120.     {
  121.         $this->formateurs = new ArrayCollection();
  122.     }
  123.     public function getIntitule(): ?string
  124.     {
  125.         return $this->intitule;
  126.     }
  127.     public function setIntitule(?string $intitule): self
  128.     {
  129.         $this->intitule $intitule;
  130.         return $this;
  131.     }
  132.     public function getType(): ?string
  133.     {
  134.         return $this->type;
  135.     }
  136.     public function setType(?string $type): self
  137.     {
  138.         $this->type $type;
  139.         return $this;
  140.     }
  141.     public function getMontant(): ?int
  142.     {
  143.         return $this->montant;
  144.     }
  145.     public function setMontant(?int $montant): LignePrestation
  146.     {
  147.         $this->montant $montant;
  148.         return $this;
  149.     }
  150.     public function getTarif(): ?int
  151.     {
  152.         return $this->tarif;
  153.     }
  154.     public function setTarif(?int $tarif): LignePrestation
  155.     {
  156.         $this->tarif $tarif;
  157.         return $this;
  158.     }
  159.     public function getStart(): ?\DateTimeInterface
  160.     {
  161.         return $this->start;
  162.     }
  163.     public function setStart(\DateTimeInterface $start): self
  164.     {
  165.         $this->start $start;
  166.         return $this;
  167.     }
  168.     public function getEnd(): ?\DateTimeInterface
  169.     {
  170.         return $this->end;
  171.     }
  172.     public function setEnd(\DateTimeInterface $end): self
  173.     {
  174.         $this->end $end;
  175.         return $this;
  176.     }
  177.     public function getStatut(): ?Masterlistelg
  178.     {
  179.         return $this->statut;
  180.     }
  181.     public function setStatut(?Masterlistelg $statut): self
  182.     {
  183.         $this->statut $statut;
  184.         return $this;
  185.     }
  186.     /**
  187.      * @return Collection<int, Formateur>
  188.      */
  189.     public function getFormateurs(): Collection
  190.     {
  191.         return $this->formateurs;
  192.     }
  193.     public function addFormateur(Formateur $formateur): self
  194.     {
  195.         if (!$this->formateurs->contains($formateur)) {
  196.             $this->formateurs->add($formateur);
  197.             $formateur->addLignePrestation($this);
  198.         }
  199.         return $this;
  200.     }
  201.     public function removeFormateur(Formateur $formateur): self
  202.     {
  203.         if ($this->formateurs->removeElement($formateur)) {
  204.             $formateur->removeLignePrestation($this);
  205.         }
  206.         return $this;
  207.     }
  208.     public function getPrestation(): ?Prestation
  209.     {
  210.         return $this->prestation;
  211.     }
  212.     public function setPrestation(?Prestation $prestation): self
  213.     {
  214.         $this->prestation $prestation;
  215.         return $this;
  216.     }
  217.     public function getIntituleSession(): ?string
  218.     {
  219.         return $this->intituleSession;
  220.     }
  221.     public function setIntituleSession(?string $intituleSession): self
  222.     {
  223.         $this->intituleSession $intituleSession;
  224.         return $this;
  225.     }
  226.     public function getModeFormation(): ?string
  227.     {
  228.         return $this->modeFormation;
  229.     }
  230.     public function setModeFormation(?string $modeFormation): self
  231.     {
  232.         $this->modeFormation $modeFormation;
  233.         return $this;
  234.     }
  235.     public function getCodeEvent(): ?string
  236.     {
  237.         return $this->codeEvent;
  238.     }
  239.     public function setCodeEvent(?string $codeEvent): self
  240.     {
  241.         $this->codeEvent $codeEvent;
  242.         return $this;
  243.     }
  244.     public function getIdEvent(): ?int
  245.     {
  246.         return $this->idEvent;
  247.     }
  248.     public function setIdEvent(?int $idEvent): self
  249.     {
  250.         $this->idEvent $idEvent;
  251.         return $this;
  252.     }
  253.     public function getDuree(): ?int
  254.     {
  255.         return $this->duree;
  256.     }
  257.     public function setDuree(?int $duree): self
  258.     {
  259.         $this->duree $duree;
  260.         return $this;
  261.     }
  262.     public function getUnite(): ?bool
  263.     {
  264.         return $this->unite;
  265.     }
  266.     public function setUnite(?bool $unite): self
  267.     {
  268.         $this->unite $unite;
  269.         return $this;
  270.     }
  271. }