src/Entity/Agent.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\AgentRepository")
  9.  */
  10. class Agent
  11. {
  12.     /**
  13.      * @ORM\Id()
  14.      * @ORM\GeneratedValue()
  15.      * @ORM\Column(type="integer")
  16.      */
  17.     private $id;
  18.     /**
  19.      * @ORM\Column(type="string", length=255)
  20.      */
  21.     private $nomAg;
  22.     /**
  23.      * @ORM\Column(type="string", length=255, nullable=true)
  24.      */
  25.     private $contactAg;
  26.     /**
  27.      * @ORM\Column(type="string", length=255, nullable=true)
  28.      */
  29.     private $imageAg;
  30.     /**
  31.      * @ORM\Column(type="string", length=1000, nullable=true)
  32.      */
  33.     private $tokenFlutter;
  34.     /**
  35.      * @ORM\Column(type="string", length=255, nullable=true)
  36.      */
  37.     private $contactWhatsapp;
  38.     /**
  39.      * @ORM\Column(type="string", length=255)
  40.      */
  41.     private $sexe;
  42.     /**
  43.      * @ORM\Column(type="boolean")
  44.      */
  45.     private $typeClientAgent;
  46.     /**
  47.      * @var string|null
  48.      */
  49.     private $picture_base64;
  50.     /**
  51.      * @ORM\OneToMany(targetEntity="App\Entity\Bois", mappedBy="idAg")
  52.      */
  53.     private $bois;
  54.     /**
  55.      * @ORM\OneToMany(targetEntity="App\Entity\Commande", mappedBy="IdAg")
  56.      */
  57.     private $agent;
  58.     /**
  59.      * @ORM\OneToMany(targetEntity="App\Entity\TransfertEnvoie", mappedBy="agent")
  60.      */
  61.     private $transfertEnvoies;
  62.     /**
  63.      * @ORM\Column(type="string", length=255, nullable=true)
  64.      */
  65.     private $contactAg1;
  66.     /**
  67.      * @ORM\OneToMany(targetEntity="App\Entity\RemarqueConteneur", mappedBy="agent")
  68.      */
  69.     private $remarqueConteneurs;
  70.     /**
  71.      * @ORM\OneToMany(targetEntity="App\Entity\Commande", mappedBy="IdCl")
  72.      */
  73.     private $commande;
  74.     /**
  75.      * @ORM\OneToMany(targetEntity=AutrePaiement::class, mappedBy="agent")
  76.      */
  77.     private $autrePaiements;
  78.     /**
  79.      * @ORM\ManyToOne(targetEntity=Ville::class, inversedBy="agents")
  80.      */
  81.     private $ville;
  82.     /**
  83.      * @ORM\OneToOne(targetEntity=Utilisateur::class, mappedBy="idAg", cascade={"persist", "remove"})
  84.      */
  85.     private $utilisateur;
  86.     /**
  87.      * @ORM\Column(type="integer")
  88.      */
  89.     private $code;
  90.     /**
  91.      * @ORM\Column(type="string", length=10)
  92.      */
  93.     private $prefixcode;
  94.     /**
  95.      * @ORM\OneToMany(targetEntity=Reception::class, mappedBy="client")
  96.      */
  97.     private $receptions;
  98.     /**
  99.      * @ORM\Column(type="string", length=5)
  100.      */
  101.     private $langue;
  102.     /**
  103.      * @ORM\Column(type="boolean")
  104.      */
  105.     private $mco;
  106.     /**
  107.      * @ORM\Column(type="boolean")
  108.      */
  109.     private $cargoAgent;
  110.     /**
  111.      * @ORM\OneToMany(targetEntity=Reduction::class, mappedBy="IdAg")
  112.      */
  113.     private $reductions;
  114.     /**
  115.      * @ORM\Column(type="boolean")
  116.      */
  117.     private $ancien;
  118.     /**
  119.      * @ORM\Column(type="boolean")
  120.      */
  121.     private $isVerifier;
  122.     /**
  123.      * @ORM\Column(type="string", length=25)
  124.      */
  125.     private $codeverification;
  126.     /**
  127.      * @ORM\Column(type="string", length=3)
  128.      */
  129.     private $clientblocker;
  130.     /**
  131.      * @ORM\Column(type="string", length=5)
  132.      */
  133.     private $admin;
  134.     /**
  135.      * CHANGEMENT 2026 : Relation OneToMany pour gérer plusieurs conteneurs
  136.      * @ORM\OneToMany(targetEntity=ProgrammeContenaire::class, mappedBy="agentGestionnaire")
  137.      */
  138.     private $programmeContenaireGestionnaire;
  139.     /**
  140.      * AJOUT 2026 : Signature faciale (Vecteur de reconnaissance)
  141.      * @ORM\Column(type="json", nullable=true)
  142.      */
  143.     private $faceSignature;
  144.     /**
  145.      * AJOUT 2026 : Historique des pointages
  146.      * @ORM\OneToMany(targetEntity="App\Entity\Attendance", mappedBy="agent", orphanRemoval=true)
  147.      */
  148.     private $attendances;
  149.     /**
  150.      * @ORM\Column(type="float", nullable=true)
  151.      */
  152.     private $dailyRate;
  153.     public function __construct()
  154.     {
  155.         $this->bois = new ArrayCollection();
  156.         $this->commande = new ArrayCollection();
  157.         $this->agent = new ArrayCollection();
  158.         $this->transfertEnvoies = new ArrayCollection();
  159.         $this->remarqueConteneurs = new ArrayCollection();
  160.         $this->autrePaiements = new ArrayCollection();
  161.         $this->receptions = new ArrayCollection();
  162.         $this->reductions = new ArrayCollection();
  163.         $this->programmeContenaireGestionnaire = new ArrayCollection();
  164.         $this->attendances = new ArrayCollection();
  165.         $this->mco false;
  166.         $this->cargoAgent false;
  167.         $this->ancien false;
  168.         $this->isVerifier false;
  169.         $this->contactAg '0';
  170.         $this->contactAg1 '0';
  171.         $this->contactWhatsapp '0';
  172.         $this->langue 'fr';
  173.     }
  174.     public function getId(): ?int
  175.     {
  176.         return $this->id;
  177.     }
  178.     public function getDailyRate(): ?float
  179.     {
  180.         // On retourne 10.0 par défaut si le taux n'est pas défini
  181.         return $this->dailyRate ?? 10.0;
  182.     }
  183.     public function setDailyRate(?float $dailyRate): self
  184.     {
  185.         $this->dailyRate $dailyRate;
  186.         return $this;
  187.     }
  188.     public function getNomAg(): ?string
  189.     {
  190.         return $this->nomAg strtoupper($this->nomAg) : null;
  191.     }
  192.     public function setNomAg(string $nomAg): self
  193.     {
  194.         $this->nomAg $nomAg;
  195.         return $this;
  196.     }
  197.     public function getContactAg(): ?string
  198.     {
  199.         return $this->contactAg;
  200.     }
  201.     public function setContactAg(?string $contactAg): self
  202.     {
  203.         $this->contactAg $contactAg;
  204.         return $this;
  205.     }
  206.     public function getImageAg(): ?string
  207.     {
  208.         return $this->imageAg;
  209.     }
  210.     public function setImageAg(?string $imageAg): self
  211.     {
  212.         $this->imageAg $imageAg;
  213.         return $this;
  214.     }
  215.     public function getSexe(): ?string
  216.     {
  217.         return $this->sexe;
  218.     }
  219.     public function setSexe(string $sexe): self
  220.     {
  221.         $this->sexe $sexe;
  222.         return $this;
  223.     }
  224.     public function getTypeClientAgent(): ?bool
  225.     {
  226.         return $this->typeClientAgent;
  227.     }
  228.     public function setTypeClientAgent(bool $typeClientAgent): self
  229.     {
  230.         $this->typeClientAgent $typeClientAgent;
  231.         return $this;
  232.     }
  233.     public function getPictureBase64(): ?string
  234.     {
  235.         return $this->picture_base64;
  236.     }
  237.     public function setPictureBase64(?string $picture_base64): self
  238.     {
  239.         $this->picture_base64 $picture_base64;
  240.         return $this;
  241.     }
  242.     public function __toString()
  243.     {
  244.         return (string) $this->nomAg;
  245.     }
  246.     /** @return Collection|Bois[] */
  247.     public function getBois(): Collection { return $this->bois; }
  248.     public function addBois(Bois $bois): self
  249.     {
  250.         if (!$this->bois->contains($bois)) {
  251.             $this->bois[] = $bois;
  252.             $bois->setIdAg($this);
  253.         }
  254.         return $this;
  255.     }
  256.     /** @return Collection|TransfertEnvoie[] */
  257.     public function getTransfertEnvoies(): Collection { return $this->transfertEnvoies; }
  258.     /** @return Collection|Commande[] */
  259.     public function getCommande(): Collection { return $this->commande; }
  260.     /** @return Collection|Commande[] */
  261.     public function getAgent(): Collection { return $this->agent; }
  262.     public function getContactAg1(): ?string { return $this->contactAg1; }
  263.     public function setContactAg1(?string $contactAg1): self
  264.     {
  265.         $this->contactAg1 $contactAg1;
  266.         return $this;
  267.     }
  268.     /** @return Collection|RemarqueConteneur[] */
  269.     public function getRemarqueConteneurs(): Collection { return $this->remarqueConteneurs; }
  270.     /** @return Collection|AutrePaiement[] */
  271.     public function getAutrePaiements(): Collection { return $this->autrePaiements; }
  272.     public function getTokenFlutter(): ?string { return $this->tokenFlutter; }
  273.     public function setTokenFlutter(?string $tokenFlutter): self $this->tokenFlutter $tokenFlutter; return $this; }
  274.     public function getContactWhatsapp(): ?string { return $this->contactWhatsapp; }
  275.     public function setContactWhatsapp(?string $contactWhatsapp): self $this->contactWhatsapp $contactWhatsapp; return $this; }
  276.     public function getVille(): ?Ville { return $this->ville; }
  277.     public function setVille(?Ville $ville): self $this->ville $ville; return $this; }
  278.     public function getUtilisateur(): ?Utilisateur { return $this->utilisateur; }
  279.     public function setUtilisateur(?Utilisateur $utilisateur): self
  280.     {
  281.         if ($utilisateur === null && $this->utilisateur !== null) {
  282.             $this->utilisateur->setIdAg(null);
  283.         }
  284.         if ($utilisateur !== null && $utilisateur->getIdAg() !== $this) {
  285.             $utilisateur->setIdAg($this);
  286.         }
  287.         $this->utilisateur $utilisateur;
  288.         return $this;
  289.     }
  290.     public function getCode(): ?int { return $this->code; }
  291.     public function setCode(int $code): self $this->code $code; return $this; }
  292.     public function getPrefixcode(): ?string { return $this->prefixcode; }
  293.     public function setPrefixcode(string $prefixcode): self $this->prefixcode $prefixcode; return $this; }
  294.     public function getLangue(): ?string { return $this->langue; }
  295.     public function setLangue(string $langue): self $this->langue $langue; return $this; }
  296.     public function isMco(): ?bool { return $this->mco; }
  297.     public function setMco(bool $mco): self $this->mco $mco; return $this; }
  298.     public function isAncien(): ?bool { return $this->ancien; }
  299.     public function setAncien(bool $ancien): self $this->ancien $ancien; return $this; }
  300.     public function isCargoAgent(): ?bool { return $this->cargoAgent; }
  301.     public function setCargoAgent(bool $cargoAgent): self $this->cargoAgent $cargoAgent; return $this; }
  302.     public function isIsVerifier(): ?bool { return $this->isVerifier; }
  303.     public function setIsVerifier(bool $isVerifier): self $this->isVerifier $isVerifier; return $this; }
  304.     public function getCodeverification(): ?string { return $this->codeverification; }
  305.     public function setCodeverification(string $codeverification): self $this->codeverification $codeverification; return $this; }
  306.     public function getClientblocker(): ?string { return $this->clientblocker; }
  307.     public function setClientblocker(string $clientblocker): self $this->clientblocker $clientblocker; return $this; }
  308.     public function getAdmin(): ?string { return $this->admin; }
  309.     public function setAdmin(string $admin): self $this->admin $admin; return $this; }
  310.     /**
  311.      * @return Collection|ProgrammeContenaire[]
  312.      */
  313.     public function getProgrammeContenaireGestionnaire(): Collection
  314.     {
  315.         return $this->programmeContenaireGestionnaire;
  316.     }
  317.     public function addProgrammeContenaireGestionnaire(ProgrammeContenaire $programme): self
  318.     {
  319.         if (!$this->programmeContenaireGestionnaire->contains($programme)) {
  320.             $this->programmeContenaireGestionnaire[] = $programme;
  321.             $programme->setAgentGestionnaire($this);
  322.         }
  323.         return $this;
  324.     }
  325.     public function removeProgrammeContenaireGestionnaire(ProgrammeContenaire $programme): self
  326.     {
  327.         if ($this->programmeContenaireGestionnaire->removeElement($programme)) {
  328.             if ($programme->getAgentGestionnaire() === $this) {
  329.                 $programme->setAgentGestionnaire(null);
  330.             }
  331.         }
  332.         return $this;
  333.     }
  334.     /**
  335.      * NOUVEAUTÉ 2026 : GETTERS ET SETTERS RECONNAISSANCE FACIALE
  336.      */
  337.     public function getFaceSignature(): ?array
  338.     {
  339.         return $this->faceSignature;
  340.     }
  341.     public function setFaceSignature(?array $faceSignature): self
  342.     {
  343.         $this->faceSignature $faceSignature;
  344.         return $this;
  345.     }
  346.     /**
  347.      * NOUVEAUTÉ 2026 : GESTION DES POINTAGES
  348.      * @return Collection|Attendance[]
  349.      */
  350.     public function getAttendances(): Collection
  351.     {
  352.         return $this->attendances;
  353.     }
  354.     public function addAttendance(Attendance $attendance): self
  355.     {
  356.         if (!$this->attendances->contains($attendance)) {
  357.             $this->attendances[] = $attendance;
  358.             $attendance->setAgent($this);
  359.         }
  360.         return $this;
  361.     }
  362.     public function removeAttendance(Attendance $attendance): self
  363.     {
  364.         if ($this->attendances->removeElement($attendance)) {
  365.             if ($attendance->getAgent() === $this) {
  366.                 $attendance->setAgent(null);
  367.             }
  368.         }
  369.         return $this;
  370.     }
  371. }