src/Entity/Gestiform/Admin/Etablissement.php line 23
<?php
namespace App\Entity\Gestiform\Admin;
use App\Entity\AbstractEntity;
use App\Entity\Common\Adresse;
use App\Entity\Common\Convention;
use App\Entity\Gestiform\Admin\MasterListe\Masterlistelg;
use App\Entity\Gestiform\Users\Employe;
use App\Repository\Gestiform\Admin\EtablissementRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Validator\Constraints as Assert;
#[UniqueEntity(fields: ['siret'], message: 'Le SIRET doit ĂȘtre unique.')]
#[ORM\Entity(repositoryClass: EtablissementRepository::class)]
class Etablissement extends AbstractEntity
{
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $intitule = null;
#[Assert\Regex(pattern: '/^\d{14}$/', message: 'Le SIRET doit contenir exactement 14 chiffres.')]
#[ORM\Column(type: 'string', length: 14, unique: true, nullable: true)]
private ?string $siret = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $numecole = null;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $noUAI = null;
#[ORM\ManyToOne(targetEntity: Adresse::class, cascade: ['persist'])]
private ?Adresse $adresse = null;
#[ORM\JoinColumn(nullable: true)]
#[ORM\ManyToOne(targetEntity: Masterlistelg::class, cascade: ['persist'])]
private ?Masterlistelg $typeAdresse = null;
#[ORM\ManyToOne(targetEntity: Tiers::class, cascade: ['persist'], inversedBy: 'etablissements')]
private ?Tiers $tiers = null;
#[ORM\JoinColumn(nullable: true)]
#[ORM\ManyToOne(targetEntity: Employe::class)]
private ?Employe $referentHandicap = null;
#[ORM\OneToMany(mappedBy: 'etablissement', targetEntity: Convention::class, cascade: ['all'])]
private Collection $conventions;
public function __construct()
{
$this->conventions = new ArrayCollection();
}
public function getReferentHandicap(): ?Employe
{
return $this->referentHandicap;
}
public function setReferentHandicap(?Employe $referentHandicap): self
{
$this->referentHandicap = $referentHandicap;
return $this;
}
public function getIntitule(): ?string
{
return $this->intitule;
}
public function setIntitule(?string $intitule): self
{
$this->intitule = $intitule;
return $this;
}
public function getSiret(): ?string
{
return $this->siret;
}
public function setSiret(?string $siret): self
{
$this->siret = $siret;
return $this;
}
public function getNumecole(): ?string
{
return $this->numecole;
}
public function setNumecole(?string $numecole): self
{
$this->numecole = $numecole;
return $this;
}
public function getAdresse(): ?Adresse
{
return $this->adresse;
}
public function setAdresse(?Adresse $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getTiers(): ?Tiers
{
return $this->tiers;
}
public function setTiers(?Tiers $tiers): self
{
$this->tiers = $tiers;
return $this;
}
/**
* @return Collection<int, Convention>
*/
public function getConventions(): Collection
{
return $this->conventions;
}
public function addConvention(Convention $convention): self
{
if (!$this->conventions->contains($convention)) {
$this->conventions->add($convention);
$convention->setEtablissement($this);
}
return $this;
}
public function removeConvention(Convention $convention): self
{
// set the owning side to null (unless already changed)
if ($this->conventions->removeElement($convention) && $convention->getEtablissement() === $this) {
$convention->setEtablissement(null);
}
return $this;
}
public function getNoUAI(): ?string
{
return $this->noUAI;
}
public function setNoUAI(?string $noUAI): self
{
$this->noUAI = $noUAI;
return $this;
}
public function getTypeAdresse(): ?Masterlistelg
{
return $this->typeAdresse;
}
public function setTypeAdresse(?Masterlistelg $typeAdresse): self
{
$this->typeAdresse = $typeAdresse;
return $this;
}
}