src/Entity/Entite.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\EntiteRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * Entité juridique du Groupe KINDI / PVN.
  9.  * Chaque enregistrement métier (employé, vente, dépense, pointage, client...)
  10.  * doit porter un `entite_id`. Voir GES-REFERENCE.md §3.
  11.  *
  12.  * @ORM\Entity(repositoryClass=EntiteRepository::class)
  13.  * @ORM\Table(name="core_entite")
  14.  */
  15. class Entite
  16. {
  17.     /** @ORM\Id @ORM\GeneratedValue @ORM\Column(type="integer") */
  18.     private $id;
  19.     /** @ORM\Column(type="string", length=30, unique=true) */
  20.     private $code;
  21.     /** @ORM\Column(type="string", length=200, name="raison_sociale") */
  22.     private $raisonSociale;
  23.     /** @ORM\Column(type="string", length=40, nullable=true) */
  24.     private $sigle;
  25.     /** @ORM\Column(type="string", length=40, nullable=true, name="forme_juridique") */
  26.     private $formeJuridique;
  27.     /** @ORM\Column(type="string", length=40, nullable=true) */
  28.     private $nif;
  29.     /** @ORM\Column(type="string", length=60, nullable=true) */
  30.     private $rccm;
  31.     /** @ORM\Column(type="text", nullable=true, name="adresse_siege") */
  32.     private $adresseSiege;
  33.     /** @ORM\Column(type="string", length=80, nullable=true) */
  34.     private $ville;
  35.     /** @ORM\Column(type="string", length=80, options={"default":"Togo"}) */
  36.     private $pays 'Togo';
  37.     /** @ORM\Column(type="string", length=10, options={"default":"XOF"}) */
  38.     private $devise 'XOF';
  39.     /**
  40.      * Convention collective applicable (BTP, Hôtellerie, Commerce, Industrie…).
  41.      * Documente la RAISON d'une grille salariale spécifique à l'entité.
  42.      * @ORM\Column(type="string", length=80, nullable=true, name="convention_collective")
  43.      */
  44.     private $conventionCollective;
  45.     /**
  46.      * Notes libres sur la politique salariale de l'entité (références,
  47.      * dérogations, accords internes). Lu par la vue comparateur grille.
  48.      * @ORM\Column(type="text", nullable=true, name="notes_grille")
  49.      */
  50.     private $notesGrille;
  51.     /** @ORM\Column(type="string", length=200, nullable=true) */
  52.     private $logo;
  53.     /** @ORM\Column(type="string", length=10, nullable=true) */
  54.     private $couleur;
  55.     /** @ORM\Column(type="boolean", options={"default":1}) */
  56.     private $actif true;
  57.     /** @ORM\Column(type="datetime", name="date_creation") */
  58.     private $dateCreation;
  59.     /** @ORM\Column(type="datetime", nullable=true, name="date_suppression") */
  60.     private $dateSuppression;
  61.     /**
  62.      * @ORM\ManyToMany(targetEntity=Produit::class, inversedBy="entites")
  63.      * @ORM\JoinTable(name="entite_produit",
  64.      *     joinColumns={@ORM\JoinColumn(name="entite_id", referencedColumnName="id")},
  65.      *     inverseJoinColumns={@ORM\JoinColumn(name="produit_id", referencedColumnName="id")}
  66.      * )
  67.      */
  68.     private Collection $produits;
  69.     public function __construct()
  70.     {
  71.         $this->dateCreation = new \DateTime();
  72.         $this->produits     = new ArrayCollection();
  73.     }
  74.     public function getId(): ?int { return $this->id; }
  75.     public function getCode(): ?string { return $this->code; }
  76.     public function setCode(string $c): self $this->code $c; return $this; }
  77.     public function getRaisonSociale(): ?string { return $this->raisonSociale; }
  78.     public function setRaisonSociale(string $r): self $this->raisonSociale $r; return $this; }
  79.     public function getSigle(): ?string { return $this->sigle; }
  80.     public function setSigle(?string $s): self $this->sigle $s; return $this; }
  81.     public function getFormeJuridique(): ?string { return $this->formeJuridique; }
  82.     public function setFormeJuridique(?string $f): self $this->formeJuridique $f; return $this; }
  83.     public function getNif(): ?string { return $this->nif; }
  84.     public function setNif(?string $n): self $this->nif $n; return $this; }
  85.     public function getRccm(): ?string { return $this->rccm; }
  86.     public function setRccm(?string $r): self $this->rccm $r; return $this; }
  87.     public function getAdresseSiege(): ?string { return $this->adresseSiege; }
  88.     public function setAdresseSiege(?string $a): self $this->adresseSiege $a; return $this; }
  89.     public function getVille(): ?string { return $this->ville; }
  90.     public function setVille(?string $v): self $this->ville $v; return $this; }
  91.     public function getPays(): ?string { return $this->pays; }
  92.     public function setPays(?string $p): self $this->pays $p; return $this; }
  93.     public function getDevise(): ?string { return $this->devise; }
  94.     public function setDevise(?string $d): self $this->devise $d; return $this; }
  95.     public function getConventionCollective(): ?string { return $this->conventionCollective; }
  96.     public function setConventionCollective(?string $cc): self $this->conventionCollective $cc; return $this; }
  97.     public function getNotesGrille(): ?string { return $this->notesGrille; }
  98.     public function setNotesGrille(?string $n): self $this->notesGrille $n; return $this; }
  99.     public function getLogo(): ?string { return $this->logo; }
  100.     public function setLogo(?string $l): self $this->logo $l; return $this; }
  101.     public function getCouleur(): ?string { return $this->couleur; }
  102.     public function setCouleur(?string $c): self $this->couleur $c; return $this; }
  103.     public function isActif(): bool { return (bool)$this->actif; }
  104.     public function setActif(bool $a): self $this->actif $a; return $this; }
  105.     public function getDateCreation(): ?\DateTimeInterface { return $this->dateCreation; }
  106.     public function getDateSuppression(): ?\DateTimeInterface { return $this->dateSuppression; }
  107.     public function setDateSuppression(?\DateTimeInterface $d): self $this->dateSuppression $d; return $this; }
  108.     public function getProduits(): Collection { return $this->produits; }
  109.     public function addProduit(Produit $p): self { if (!$this->produits->contains($p)) { $this->produits->add($p); } return $this; }
  110.     public function removeProduit(Produit $p): self $this->produits->removeElement($p); return $this; }
  111.     public function hasProduit(Produit $p): bool { return $this->produits->contains($p); }
  112.     public function __toString(): string
  113.     {
  114.         return $this->sigle ?: ($this->raisonSociale ?? ('Entite#'.$this->id));
  115.     }
  116.     public function toArray(): array
  117.     {
  118.         return [
  119.             'id'              => $this->id,
  120.             'code'            => $this->code,
  121.             'raison_sociale'  => $this->raisonSociale,
  122.             'sigle'           => $this->sigle,
  123.             'forme_juridique' => $this->formeJuridique,
  124.             'nif'             => $this->nif,
  125.             'rccm'            => $this->rccm,
  126.             'adresse_siege'   => $this->adresseSiege,
  127.             'ville'           => $this->ville,
  128.             'pays'            => $this->pays,
  129.             'devise'          => $this->devise,
  130.             'convention_collective' => $this->conventionCollective,
  131.             'notes_grille'    => $this->notesGrille,
  132.             'couleur'         => $this->couleur,
  133.             'actif'           => (bool)$this->actif,
  134.         ];
  135.     }
  136. }