src/Entity/Gestiform/Formations/Entreprise/Contrat.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Gestiform\Formations\Entreprise;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Common\Upload;
  5. use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
  6. use App\Entity\Gestiform\Admin\Societe;
  7. use App\Entity\Gestiform\Formations\Session\FormateurEvent;
  8. use App\Entity\Gestiform\Formations\Session\Planning\Prestation;
  9. use App\Entity\Gestiform\Users\Formateur;
  10. use App\Repository\Gestiform\Formations\Entreprise\ContratRepository;
  11. use Doctrine\Common\Collections\ArrayCollection;
  12. use Doctrine\Common\Collections\Collection;
  13. use Doctrine\DBAL\Types\Types;
  14. use Doctrine\ORM\Mapping as ORM;
  15. /**
  16.  * @ORM\Entity(repositoryClass=ContratRepository::class)
  17.  */
  18. class Contrat extends AbstractEntity
  19. {
  20.     /**
  21.      * @ORM\Column(type="text", nullable=true)
  22.      */
  23.     private ?string $reference null;
  24.     /**
  25.      * @ORM\Column(type="text", nullable=true)
  26.      */
  27.     private ?string $tarif null;
  28.     /**
  29.      * @ORM\Column(type="text", nullable=true)
  30.      */
  31.     private ?string $duree null;
  32.     /**
  33.      * @ORM\Column(type="boolean", nullable=true)
  34.      */
  35.     private ?bool $tva false;
  36.     /**
  37.      * @ORM\Column(type="datetime")
  38.      */
  39.     private ?\DateTime $start;
  40.     /**
  41.      * @ORM\Column(type="datetime")
  42.      */
  43.     private ?\DateTime $end null;
  44.     /**
  45.      * @ORM\ManyToOne(targetEntity=Masterlistelg::class)
  46.      */
  47.     private ?Masterlistelg $statut null;
  48.     /**
  49.      * @ORM\ManyToOne(targetEntity=Masterlistelg::class)
  50.      */
  51.     private ?Masterlistelg $type null;
  52.     /**
  53.      * @ORM\ManyToOne(targetEntity=Masterlistelg::class)
  54.      */
  55.     private ?Masterlistelg $objet null;
  56.     /**
  57.      * @ORM\ManyToMany(targetEntity=Formateur::class, inversedBy="contrats",cascade={"persist"})
  58.      */
  59.     private Collection $formateurs;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=Societe::class)
  62.      */
  63.     private ?Societe $societe null;
  64.     /**
  65.      * @ORM\ManyToOne(targetEntity=Entreprise::class, inversedBy="contrats")
  66.      */
  67.     private ?Entreprise $entreprise null;
  68.     /**
  69.      * @ORM\OneToOne(targetEntity=Upload::class, cascade={"persist", "remove"})
  70.      * @ORM\JoinColumn(nullable=true)
  71.      */
  72.     private ?Upload $signatureFile null;
  73.     /**
  74.      * @ORM\OneToMany(targetEntity=Prestation::class, mappedBy="contrat",cascade={"persist", "remove"})
  75.      */
  76.     private Collection $prestations;
  77.     public function __construct()
  78.     {
  79.         $this->prestations = new ArrayCollection();
  80.         $this->formateurs = new ArrayCollection();
  81.     }
  82.     public function getReference(): ?string
  83.     {
  84.         return $this->reference;
  85.     }
  86.     public function setReference(?string $reference): self
  87.     {
  88.         $this->reference $reference;
  89.         return $this;
  90.     }
  91.     public function getTarif(): ?string
  92.     {
  93.         return $this->tarif;
  94.     }
  95.     public function setTarif(?string $tarif): self
  96.     {
  97.         $this->tarif $tarif;
  98.         return $this;
  99.     }
  100.     public function getDuree(): ?string
  101.     {
  102.         return $this->duree;
  103.     }
  104.     public function setDuree(?string $duree): self
  105.     {
  106.         $this->duree $duree;
  107.         return $this;
  108.     }
  109.     public function isTva(): ?bool
  110.     {
  111.         return $this->tva;
  112.     }
  113.     public function setTva(?bool $tva): self
  114.     {
  115.         $this->tva $tva;
  116.         return $this;
  117.     }
  118.     public function getStart(): ?\DateTimeInterface
  119.     {
  120.         return $this->start;
  121.     }
  122.     public function setStart(\DateTimeInterface $start): self
  123.     {
  124.         $this->start $start;
  125.         return $this;
  126.     }
  127.     public function getEnd(): ?\DateTimeInterface
  128.     {
  129.         return $this->end;
  130.     }
  131.     public function setEnd(\DateTimeInterface $end): self
  132.     {
  133.         $this->end $end;
  134.         return $this;
  135.     }
  136.     public function getStatut(): ?Masterlistelg
  137.     {
  138.         return $this->statut;
  139.     }
  140.     public function setStatut(?Masterlistelg $statut): self
  141.     {
  142.         $this->statut $statut;
  143.         return $this;
  144.     }
  145.     public function getType(): ?Masterlistelg
  146.     {
  147.         return $this->type;
  148.     }
  149.     public function setType(?Masterlistelg $type): self
  150.     {
  151.         $this->type $type;
  152.         return $this;
  153.     }
  154.     public function getObjet(): ?Masterlistelg
  155.     {
  156.         return $this->objet;
  157.     }
  158.     public function setObjet(?Masterlistelg $objet): self
  159.     {
  160.         $this->objet $objet;
  161.         return $this;
  162.     }
  163.     public function getSociete(): ?Societe
  164.     {
  165.         return $this->societe;
  166.     }
  167.     public function setSociete(?Societe $societe): self
  168.     {
  169.         $this->societe $societe;
  170.         return $this;
  171.     }
  172.     public function getEntreprise(): ?Entreprise
  173.     {
  174.         return $this->entreprise;
  175.     }
  176.     public function setEntreprise(?Entreprise $entreprise): self
  177.     {
  178.         $this->entreprise $entreprise;
  179.         return $this;
  180.     }
  181.     public function getSignatureFile(): ?Upload
  182.     {
  183.         return $this->signatureFile;
  184.     }
  185.     public function setSignatureFile(?Upload $signatureFile): self
  186.     {
  187.         $this->signatureFile $signatureFile;
  188.         return $this;
  189.     }
  190.     /**
  191.      * @return Collection<int, Formateur>
  192.      */
  193.     public function getFormateurs(): Collection
  194.     {
  195.         return $this->formateurs;
  196.     }
  197.     public function addFormateur(Formateur $formateur): self
  198.     {
  199.         if (!$this->formateurs->contains($formateur)) {
  200.             $this->formateurs->add($formateur);
  201.         }
  202.         return $this;
  203.     }
  204.     public function removeFormateur(Formateur $formateur): self
  205.     {
  206.         $this->formateurs->removeElement($formateur);
  207.         return $this;
  208.     }
  209.     public function getResponsable()
  210.     {
  211.         if (!is_null($this->getType()) and
  212.             $this->getType()->getCode() == 'SOUS-TRAITANCE') {
  213.             return $this->getEntreprise()?->getPersonne();
  214.         } elseif (!empty($this->getFormateurs())) {
  215.             return $this->getFormateurs()->first();
  216.         }
  217.         return null;
  218.     }
  219.     /**
  220.      * @return Collection<int, Prestation>
  221.      */
  222.     public function getPrestations(): Collection
  223.     {
  224.         return $this->prestations;
  225.     }
  226.     public function addPrestation(Prestation $prestation): self
  227.     {
  228.         if (!$this->prestations->contains($prestation)) {
  229.             $this->prestations->add($prestation);
  230.             $prestation->setContrat($this);
  231.         }
  232.         return $this;
  233.     }
  234.     public function removePrestation(Prestation $prestation): self
  235.     {
  236.         if ($this->prestations->removeElement($prestation)) {
  237.             // set the owning side to null (unless already changed)
  238.             if ($prestation->getContrat() === $this) {
  239.                 $prestation->setContrat(null);
  240.             }
  241.         }
  242.         return $this;
  243.     }
  244. }