src/Entity/Gestiform/Admin/Etablissement.php line 23

  1. <?php
  2. namespace App\Entity\Gestiform\Admin;
  3. use App\Entity\AbstractEntity;
  4. use App\Entity\Common\Adresse;
  5. use App\Entity\Common\Convention;
  6. use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
  7. use App\Entity\Gestiform\Users\Employe;
  8. use App\Repository\Gestiform\Admin\EtablissementRepository;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Doctrine\Common\Collections\Collection;
  11. use Doctrine\DBAL\Types\Types;
  12. use Doctrine\ORM\Mapping as ORM;
  13. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  14. use Symfony\Component\Validator\Constraints as Assert;
  15. #[UniqueEntity(fields: ['siret'], message'Le SIRET doit ĂȘtre unique.')]
  16. #[ORM\Entity(repositoryClassEtablissementRepository::class)]
  17. class Etablissement extends AbstractEntity
  18. {
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private ?string $intitule null;
  21.     #[Assert\Regex(pattern'/^\d{14}$/'message'Le SIRET doit contenir exactement 14 chiffres.')]
  22.     #[ORM\Column(type'string'length14uniquetruenullabletrue)]
  23.     private ?string $siret null;
  24.     #[ORM\Column(type'string'length255nullabletrue)]
  25.     private ?string $numecole null;
  26.     #[ORM\Column(type'string'length255nullabletrue)]
  27.     private ?string $noUAI null;
  28.     #[ORM\ManyToOne(targetEntityAdresse::class, cascade: ['persist'])]
  29.     private ?Adresse $adresse null;
  30.     #[ORM\JoinColumn(nullabletrue)]
  31.     #[ORM\ManyToOne(targetEntityMasterlistelg::class, cascade: ['persist'])]
  32.     private ?Masterlistelg $typeAdresse null;
  33.     #[ORM\ManyToOne(targetEntityTiers::class, cascade: ['persist'], inversedBy'etablissements')]
  34.     private ?Tiers $tiers null;
  35.     #[ORM\JoinColumn(nullabletrue)]
  36.     #[ORM\ManyToOne(targetEntityEmploye::class)]
  37.     private ?Employe $referentHandicap null;
  38.     #[ORM\OneToMany(mappedBy'etablissement'targetEntityConvention::class, cascade: ['all'])]
  39.     private Collection $conventions;
  40.     public function __construct()
  41.     {
  42.         $this->conventions = new ArrayCollection();
  43.     }
  44.     public function getReferentHandicap(): ?Employe
  45.     {
  46.         return $this->referentHandicap;
  47.     }
  48.     public function setReferentHandicap(?Employe $referentHandicap): self
  49.     {
  50.         $this->referentHandicap $referentHandicap;
  51.         return $this;
  52.     }
  53.     public function getIntitule(): ?string
  54.     {
  55.         return $this->intitule;
  56.     }
  57.     public function setIntitule(?string $intitule): self
  58.     {
  59.         $this->intitule $intitule;
  60.         return $this;
  61.     }
  62.     public function getSiret(): ?string
  63.     {
  64.         return $this->siret;
  65.     }
  66.     public function setSiret(?string $siret): self
  67.     {
  68.         $this->siret $siret;
  69.         return $this;
  70.     }
  71.     public function getNumecole(): ?string
  72.     {
  73.         return $this->numecole;
  74.     }
  75.     public function setNumecole(?string $numecole): self
  76.     {
  77.         $this->numecole $numecole;
  78.         return $this;
  79.     }
  80.     public function getAdresse(): ?Adresse
  81.     {
  82.         return $this->adresse;
  83.     }
  84.     public function setAdresse(?Adresse $adresse): self
  85.     {
  86.         $this->adresse $adresse;
  87.         return $this;
  88.     }
  89.     public function getTiers(): ?Tiers
  90.     {
  91.         return $this->tiers;
  92.     }
  93.     public function setTiers(?Tiers $tiers): self
  94.     {
  95.         $this->tiers $tiers;
  96.         return $this;
  97.     }
  98.     /**
  99.      * @return Collection<int, Convention>
  100.      */
  101.     public function getConventions(): Collection
  102.     {
  103.         return $this->conventions;
  104.     }
  105.     public function addConvention(Convention $convention): self
  106.     {
  107.         if (!$this->conventions->contains($convention)) {
  108.             $this->conventions->add($convention);
  109.             $convention->setEtablissement($this);
  110.         }
  111.         return $this;
  112.     }
  113.     public function removeConvention(Convention $convention): self
  114.     {
  115.         // set the owning side to null (unless already changed)
  116.         if ($this->conventions->removeElement($convention) && $convention->getEtablissement() === $this) {
  117.             $convention->setEtablissement(null);
  118.         }
  119.         return $this;
  120.     }
  121.     public function getNoUAI(): ?string
  122.     {
  123.         return $this->noUAI;
  124.     }
  125.     public function setNoUAI(?string $noUAI): self
  126.     {
  127.         $this->noUAI $noUAI;
  128.         return $this;
  129.     }
  130.     public function getTypeAdresse(): ?Masterlistelg
  131.     {
  132.         return $this->typeAdresse;
  133.     }
  134.     public function setTypeAdresse(?Masterlistelg $typeAdresse): self
  135.     {
  136.         $this->typeAdresse $typeAdresse;
  137.         return $this;
  138.     }
  139. }