<?php
namespace App\Entity;
use App\Repository\EntiteRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Entité juridique du Groupe KINDI / PVN.
* Chaque enregistrement métier (employé, vente, dépense, pointage, client...)
* doit porter un `entite_id`. Voir GES-REFERENCE.md §3.
*
* @ORM\Entity(repositoryClass=EntiteRepository::class)
* @ORM\Table(name="core_entite")
*/
class Entite
{
/** @ORM\Id @ORM\GeneratedValue @ORM\Column(type="integer") */
private $id;
/** @ORM\Column(type="string", length=30, unique=true) */
private $code;
/** @ORM\Column(type="string", length=200, name="raison_sociale") */
private $raisonSociale;
/** @ORM\Column(type="string", length=40, nullable=true) */
private $sigle;
/** @ORM\Column(type="string", length=40, nullable=true, name="forme_juridique") */
private $formeJuridique;
/** @ORM\Column(type="string", length=40, nullable=true) */
private $nif;
/** @ORM\Column(type="string", length=60, nullable=true) */
private $rccm;
/** @ORM\Column(type="text", nullable=true, name="adresse_siege") */
private $adresseSiege;
/** @ORM\Column(type="string", length=80, nullable=true) */
private $ville;
/** @ORM\Column(type="string", length=80, options={"default":"Togo"}) */
private $pays = 'Togo';
/** @ORM\Column(type="string", length=10, options={"default":"XOF"}) */
private $devise = 'XOF';
/**
* Convention collective applicable (BTP, Hôtellerie, Commerce, Industrie…).
* Documente la RAISON d'une grille salariale spécifique à l'entité.
* @ORM\Column(type="string", length=80, nullable=true, name="convention_collective")
*/
private $conventionCollective;
/**
* Notes libres sur la politique salariale de l'entité (références,
* dérogations, accords internes). Lu par la vue comparateur grille.
* @ORM\Column(type="text", nullable=true, name="notes_grille")
*/
private $notesGrille;
/** @ORM\Column(type="string", length=200, nullable=true) */
private $logo;
/** @ORM\Column(type="string", length=10, nullable=true) */
private $couleur;
/** @ORM\Column(type="boolean", options={"default":1}) */
private $actif = true;
/** @ORM\Column(type="datetime", name="date_creation") */
private $dateCreation;
/** @ORM\Column(type="datetime", nullable=true, name="date_suppression") */
private $dateSuppression;
/**
* @ORM\ManyToMany(targetEntity=Produit::class, inversedBy="entites")
* @ORM\JoinTable(name="entite_produit",
* joinColumns={@ORM\JoinColumn(name="entite_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="produit_id", referencedColumnName="id")}
* )
*/
private Collection $produits;
public function __construct()
{
$this->dateCreation = new \DateTime();
$this->produits = new ArrayCollection();
}
public function getId(): ?int { return $this->id; }
public function getCode(): ?string { return $this->code; }
public function setCode(string $c): self { $this->code = $c; return $this; }
public function getRaisonSociale(): ?string { return $this->raisonSociale; }
public function setRaisonSociale(string $r): self { $this->raisonSociale = $r; return $this; }
public function getSigle(): ?string { return $this->sigle; }
public function setSigle(?string $s): self { $this->sigle = $s; return $this; }
public function getFormeJuridique(): ?string { return $this->formeJuridique; }
public function setFormeJuridique(?string $f): self { $this->formeJuridique = $f; return $this; }
public function getNif(): ?string { return $this->nif; }
public function setNif(?string $n): self { $this->nif = $n; return $this; }
public function getRccm(): ?string { return $this->rccm; }
public function setRccm(?string $r): self { $this->rccm = $r; return $this; }
public function getAdresseSiege(): ?string { return $this->adresseSiege; }
public function setAdresseSiege(?string $a): self { $this->adresseSiege = $a; return $this; }
public function getVille(): ?string { return $this->ville; }
public function setVille(?string $v): self { $this->ville = $v; return $this; }
public function getPays(): ?string { return $this->pays; }
public function setPays(?string $p): self { $this->pays = $p; return $this; }
public function getDevise(): ?string { return $this->devise; }
public function setDevise(?string $d): self { $this->devise = $d; return $this; }
public function getConventionCollective(): ?string { return $this->conventionCollective; }
public function setConventionCollective(?string $cc): self { $this->conventionCollective = $cc; return $this; }
public function getNotesGrille(): ?string { return $this->notesGrille; }
public function setNotesGrille(?string $n): self { $this->notesGrille = $n; return $this; }
public function getLogo(): ?string { return $this->logo; }
public function setLogo(?string $l): self { $this->logo = $l; return $this; }
public function getCouleur(): ?string { return $this->couleur; }
public function setCouleur(?string $c): self { $this->couleur = $c; return $this; }
public function isActif(): bool { return (bool)$this->actif; }
public function setActif(bool $a): self { $this->actif = $a; return $this; }
public function getDateCreation(): ?\DateTimeInterface { return $this->dateCreation; }
public function getDateSuppression(): ?\DateTimeInterface { return $this->dateSuppression; }
public function setDateSuppression(?\DateTimeInterface $d): self { $this->dateSuppression = $d; return $this; }
public function getProduits(): Collection { return $this->produits; }
public function addProduit(Produit $p): self { if (!$this->produits->contains($p)) { $this->produits->add($p); } return $this; }
public function removeProduit(Produit $p): self { $this->produits->removeElement($p); return $this; }
public function hasProduit(Produit $p): bool { return $this->produits->contains($p); }
public function __toString(): string
{
return $this->sigle ?: ($this->raisonSociale ?? ('Entite#'.$this->id));
}
public function toArray(): array
{
return [
'id' => $this->id,
'code' => $this->code,
'raison_sociale' => $this->raisonSociale,
'sigle' => $this->sigle,
'forme_juridique' => $this->formeJuridique,
'nif' => $this->nif,
'rccm' => $this->rccm,
'adresse_siege' => $this->adresseSiege,
'ville' => $this->ville,
'pays' => $this->pays,
'devise' => $this->devise,
'convention_collective' => $this->conventionCollective,
'notes_grille' => $this->notesGrille,
'couleur' => $this->couleur,
'actif' => (bool)$this->actif,
];
}
}