<?php
namespace App\Entity\Gestiform\Formations\Session\Planning;
use App\Entity\AbstractEntity;
use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
use App\Entity\Gestiform\Users\Formateur;
use App\Repository\Gestiform\Formations\Session\Planning\LignePrestationRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity(repositoryClass=LignePrestationRepository::class)
*/
class LignePrestation extends AbstractEntity
{
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $intitule = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $type = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $intituleSession = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $modeFormation = null;
/**
* @ORM\Column(type="string", nullable=true)
*/
private ?string $codeEvent = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $idEvent = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $duree = null;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private ?bool $unite = false;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $montant = null;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private ?int $tarif = null;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTime $start;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private ?\DateTime $end = null;
/**
* @ORM\ManyToOne(targetEntity=Masterlistelg::class)
*/
private ?Masterlistelg $statut = null;
/**
* @ORM\ManyToMany(targetEntity=Formateur::class, inversedBy="lignePrestations")
*/
private Collection $formateurs;
/**
* @ORM\ManyToOne(targetEntity=Prestation::class, inversedBy="lignePrestations")
*/
private ?Prestation $prestation = null;
/**
* @ORM\Column(type="json", nullable=true)
*/
private ?array $eventChilds = null;
public function getEventChilds(): array
{
return $this->eventChilds ?? [];
}
public function addEventChild(string $idEvent, string $intitule): self
{
$data = $this->getEventChilds();
$exist = false;
foreach ($data as &$item) {
if ($item['idEvent'] === $idEvent) {
$item['intitule'] = $intitule;
$exist = true;
break;
}
}
if (!$exist) {
$data[] = [
'idEvent' => $idEvent,
'intitule' => $intitule,
];
}
$this->eventChilds = $data;
return $this;
}
public function removeEventChild(string $idEvent): self
{
$data = $this->getEventChilds();
foreach ($data as $key => $item) {
if ($item['idEvent'] === $idEvent) {
unset($data[$key]);
}
}
$this->eventChilds = array_values($data);
return $this;
}
public function clearEventChilds(): self
{
$this->eventChilds = [];
return $this;
}
public function __construct()
{
$this->formateurs = new ArrayCollection();
}
public function getIntitule(): ?string
{
return $this->intitule;
}
public function setIntitule(?string $intitule): self
{
$this->intitule = $intitule;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getMontant(): ?int
{
return $this->montant;
}
public function setMontant(?int $montant): LignePrestation
{
$this->montant = $montant;
return $this;
}
public function getTarif(): ?int
{
return $this->tarif;
}
public function setTarif(?int $tarif): LignePrestation
{
$this->tarif = $tarif;
return $this;
}
public function getStart(): ?\DateTimeInterface
{
return $this->start;
}
public function setStart(\DateTimeInterface $start): self
{
$this->start = $start;
return $this;
}
public function getEnd(): ?\DateTimeInterface
{
return $this->end;
}
public function setEnd(\DateTimeInterface $end): self
{
$this->end = $end;
return $this;
}
public function getStatut(): ?Masterlistelg
{
return $this->statut;
}
public function setStatut(?Masterlistelg $statut): self
{
$this->statut = $statut;
return $this;
}
/**
* @return Collection<int, Formateur>
*/
public function getFormateurs(): Collection
{
return $this->formateurs;
}
public function addFormateur(Formateur $formateur): self
{
if (!$this->formateurs->contains($formateur)) {
$this->formateurs->add($formateur);
$formateur->addLignePrestation($this);
}
return $this;
}
public function removeFormateur(Formateur $formateur): self
{
if ($this->formateurs->removeElement($formateur)) {
$formateur->removeLignePrestation($this);
}
return $this;
}
public function getPrestation(): ?Prestation
{
return $this->prestation;
}
public function setPrestation(?Prestation $prestation): self
{
$this->prestation = $prestation;
return $this;
}
public function getIntituleSession(): ?string
{
return $this->intituleSession;
}
public function setIntituleSession(?string $intituleSession): self
{
$this->intituleSession = $intituleSession;
return $this;
}
public function getModeFormation(): ?string
{
return $this->modeFormation;
}
public function setModeFormation(?string $modeFormation): self
{
$this->modeFormation = $modeFormation;
return $this;
}
public function getCodeEvent(): ?string
{
return $this->codeEvent;
}
public function setCodeEvent(?string $codeEvent): self
{
$this->codeEvent = $codeEvent;
return $this;
}
public function getIdEvent(): ?int
{
return $this->idEvent;
}
public function setIdEvent(?int $idEvent): self
{
$this->idEvent = $idEvent;
return $this;
}
public function getDuree(): ?int
{
return $this->duree;
}
public function setDuree(?int $duree): self
{
$this->duree = $duree;
return $this;
}
public function getUnite(): ?bool
{
return $this->unite;
}
public function setUnite(?bool $unite): self
{
$this->unite = $unite;
return $this;
}
}