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.      * Transferts enregistrés par cet agent
  60.      * @ORM\OneToMany(targetEntity="App\Entity\TransfertEnvoie", mappedBy="agent")
  61.      */
  62.     private $transfertEnvoies;
  63.     /**
  64.      * Transferts envoyés par cet agent (en tant que client expéditeur)
  65.      * @ORM\OneToMany(targetEntity="App\Entity\TransfertEnvoie", mappedBy="clientExpediteur")
  66.      */
  67.     private $transfertsEnvoyesClient;
  68.     /**
  69.      * Transferts reçus par cet agent (en tant que client destinataire)
  70.      * @ORM\OneToMany(targetEntity="App\Entity\TransfertEnvoie", mappedBy="clientDestinateur")
  71.      */
  72.     private $transfertsRecusClient;
  73.     /**
  74.      * @ORM\Column(type="string", length=255, nullable=true)
  75.      */
  76.     private $contactAg1;
  77.     /**
  78.      * @ORM\OneToMany(targetEntity="App\Entity\RemarqueConteneur", mappedBy="agent")
  79.      */
  80.     private $remarqueConteneurs;
  81.     /**
  82.      * @ORM\OneToMany(targetEntity="App\Entity\Commande", mappedBy="IdCl")
  83.      */
  84.     private $commande;
  85.     /**
  86.      * Paiements enregistrés par cet agent
  87.      * @ORM\OneToMany(targetEntity=AutrePaiement::class, mappedBy="agent")
  88.      */
  89.     private $autrePaiements;
  90.     /**
  91.      * Paiements reçus/effectués par ce client (s'il s'agit d'un agent de type client)
  92.      * @ORM\OneToMany(targetEntity=AutrePaiement::class, mappedBy="client")
  93.      */
  94.     private $autrePaiementsClient;
  95.     /**
  96.      * @ORM\ManyToOne(targetEntity=Ville::class, inversedBy="agents")
  97.      */
  98.     private $ville;
  99.     /**
  100.      * @ORM\OneToOne(targetEntity=Utilisateur::class, mappedBy="idAg", cascade={"persist", "remove"})
  101.      */
  102.     private $utilisateur;
  103.     /**
  104.      * @ORM\Column(type="integer")
  105.      */
  106.     private $code;
  107.     /**
  108.      * @ORM\Column(type="string", length=10)
  109.      */
  110.     private $prefixcode;
  111.     /**
  112.      * @ORM\OneToMany(targetEntity=Reception::class, mappedBy="client")
  113.      */
  114.     private $receptions;
  115.     /**
  116.      * @ORM\Column(type="string", length=5)
  117.      */
  118.     private $langue;
  119.     /**
  120.      * @ORM\Column(type="boolean")
  121.      */
  122.     private $mco;
  123.     /**
  124.      * @ORM\Column(type="boolean")
  125.      */
  126.     private $cargoAgent;
  127.     /**
  128.      * @ORM\OneToMany(targetEntity=Reduction::class, mappedBy="IdAg")
  129.      */
  130.     private $reductions;
  131.     /**
  132.      * @ORM\Column(type="boolean")
  133.      */
  134.     private $ancien;
  135.     /**
  136.      * @ORM\Column(type="boolean")
  137.      */
  138.     private $isVerifier;
  139.     /**
  140.      * @ORM\Column(type="string", length=25)
  141.      */
  142.     private $codeverification;
  143.     /**
  144.      * @ORM\Column(type="string", length=3)
  145.      */
  146.     private $clientblocker;
  147.     /**
  148.      * @ORM\Column(type="string", length=5)
  149.      */
  150.     private $admin;
  151.     /**
  152.      * @ORM\OneToMany(targetEntity=ProgrammeContenaire::class, mappedBy="agentGestionnaire")
  153.      */
  154.     private $programmeContenaireGestionnaire;
  155.     /**
  156.      * @ORM\Column(type="json", nullable=true)
  157.      */
  158.     private $faceSignature;
  159.     /**
  160.      * @ORM\OneToMany(targetEntity="App\Entity\Attendance", mappedBy="agent", orphanRemoval=true)
  161.      */
  162.     private $attendances;
  163.     /**
  164.      * @ORM\Column(type="float", nullable=true)
  165.      */
  166.     private $dailyRate;
  167.     public function __construct()
  168.     {
  169.         $this->bois = new ArrayCollection();
  170.         $this->commande = new ArrayCollection();
  171.         $this->agent = new ArrayCollection();
  172.         $this->transfertEnvoies = new ArrayCollection();
  173.         $this->transfertsEnvoyesClient = new ArrayCollection();
  174.         $this->transfertsRecusClient = new ArrayCollection();
  175.         $this->remarqueConteneurs = new ArrayCollection();
  176.         $this->autrePaiements = new ArrayCollection();
  177.         $this->autrePaiementsClient = new ArrayCollection();
  178.         $this->receptions = new ArrayCollection();
  179.         $this->reductions = new ArrayCollection();
  180.         $this->programmeContenaireGestionnaire = new ArrayCollection();
  181.         $this->attendances = new ArrayCollection();
  182.         $this->mco = false;
  183.         $this->cargoAgent = false;
  184.         $this->ancien = false;
  185.         $this->isVerifier = false;
  186.         $this->contactAg = '0';
  187.         $this->contactAg1 = '0';
  188.         $this->contactWhatsapp = '0';
  189.         $this->langue = 'fr';
  190.     }
  191.     public function getId(): ?int
  192.     {
  193.         return $this->id;
  194.     }
  195.     public function getDailyRate(): ?float
  196.     {
  197.         return $this->dailyRate ?? 10.0;
  198.     }
  199.     public function setDailyRate(?float $dailyRate): self
  200.     {
  201.         $this->dailyRate = $dailyRate;
  202.         return $this;
  203.     }
  204.     public function getNomAg(): ?string
  205.     {
  206.         return $this->nomAg ? strtoupper($this->nomAg) : null;
  207.     }
  208.     public function setNomAg(string $nomAg): self
  209.     {
  210.         $this->nomAg = $nomAg;
  211.         return $this;
  212.     }
  213.     public function getContactAg(): ?string
  214.     {
  215.         return $this->contactAg;
  216.     }
  217.     public function setContactAg(?string $contactAg): self
  218.     {
  219.         $this->contactAg = $contactAg;
  220.         return $this;
  221.     }
  222.     public function getImageAg(): ?string
  223.     {
  224.         return $this->imageAg;
  225.     }
  226.     public function setImageAg(?string $imageAg): self
  227.     {
  228.         $this->imageAg = $imageAg;
  229.         return $this;
  230.     }
  231.     public function getSexe(): ?string
  232.     {
  233.         return $this->sexe;
  234.     }
  235.     public function setSexe(string $sexe): self
  236.     {
  237.         $this->sexe = $sexe;
  238.         return $this;
  239.     }
  240.     public function getTypeClientAgent(): ?bool
  241.     {
  242.         return $this->typeClientAgent;
  243.     }
  244.     public function setTypeClientAgent(bool $typeClientAgent): self
  245.     {
  246.         $this->typeClientAgent = $typeClientAgent;
  247.         return $this;
  248.     }
  249.     public function getPictureBase64(): ?string
  250.     {
  251.         return $this->picture_base64;
  252.     }
  253.     public function setPictureBase64(?string $picture_base64): self
  254.     {
  255.         $this->picture_base64 = $picture_base64;
  256.         return $this;
  257.     }
  258.     public function __toString()
  259.     {
  260.         return (string) $this->nomAg;
  261.     }
  262.     /** @return Collection|Bois[] */
  263.     public function getBois(): Collection { return $this->bois; }
  264.     public function addBois(Bois $bois): self
  265.     {
  266.         if (!$this->bois->contains($bois)) {
  267.             $this->bois[] = $bois;
  268.             $bois->setIdAg($this);
  269.         }
  270.         return $this;
  271.     }
  272.     /** @return Collection|TransfertEnvoie[] */
  273.     public function getTransfertEnvoies(): Collection { return $this->transfertEnvoies; }
  274.     /** @return Collection|TransfertEnvoie[] */
  275.     public function getTransfertsEnvoyesClient(): Collection
  276.     {
  277.         return $this->transfertsEnvoyesClient;
  278.     }
  279.     public function addTransfertsEnvoyesClient(TransfertEnvoie $transfert): self
  280.     {
  281.         if (!$this->transfertsEnvoyesClient->contains($transfert)) {
  282.             $this->transfertsEnvoyesClient[] = $transfert;
  283.             $transfert->setClientExpediteur($this);
  284.         }
  285.         return $this;
  286.     }
  287.     public function removeTransfertsEnvoyesClient(TransfertEnvoie $transfert): self
  288.     {
  289.         if ($this->transfertsEnvoyesClient->removeElement($transfert)) {
  290.             if ($transfert->getClientExpediteur() === $this) {
  291.                 $transfert->setClientExpediteur(null);
  292.             }
  293.         }
  294.         return $this;
  295.     }
  296.     /** @return Collection|TransfertEnvoie[] */
  297.     public function getTransfertsRecusClient(): Collection
  298.     {
  299.         return $this->transfertsRecusClient;
  300.     }
  301.     public function addTransfertsRecusClient(TransfertEnvoie $transfert): self
  302.     {
  303.         if (!$this->transfertsRecusClient->contains($transfert)) {
  304.             $this->transfertsRecusClient[] = $transfert;
  305.             $transfert->setClientDestinateur($this);
  306.         }
  307.         return $this;
  308.     }
  309.     public function removeTransfertsRecusClient(TransfertEnvoie $transfert): self
  310.     {
  311.         if ($this->transfertsRecusClient->removeElement($transfert)) {
  312.             if ($transfert->getClientDestinateur() === $this) {
  313.                 $transfert->setClientDestinateur(null);
  314.             }
  315.         }
  316.         return $this;
  317.     }
  318.     /** @return Collection|Commande[] */
  319.     public function getCommande(): Collection { return $this->commande; }
  320.     /** @return Collection|Commande[] */
  321.     public function getAgent(): Collection { return $this->agent; }
  322.     public function getContactAg1(): ?string { return $this->contactAg1; }
  323.     public function setContactAg1(?string $contactAg1): self
  324.     {
  325.         $this->contactAg1 = $contactAg1;
  326.         return $this;
  327.     }
  328.     /** @return Collection|RemarqueConteneur[] */
  329.     public function getRemarqueConteneurs(): Collection { return $this->remarqueConteneurs; }
  330.     /** @return Collection|AutrePaiement[] */
  331.     public function getAutrePaiements(): Collection { return $this->autrePaiements; }
  332.     public function addAutrePaiement(AutrePaiement $autrePaiement): self
  333.     {
  334.         if (!$this->autrePaiements->contains($autrePaiement)) {
  335.             $this->autrePaiements[] = $autrePaiement;
  336.             $autrePaiement->setAgent($this);
  337.         }
  338.         return $this;
  339.     }
  340.     public function removeAutrePaiement(AutrePaiement $autrePaiement): self
  341.     {
  342.         if ($this->autrePaiements->removeElement($autrePaiement)) {
  343.             if ($autrePaiement->getAgent() === $this) {
  344.                 $autrePaiement->setAgent(null);
  345.             }
  346.         }
  347.         return $this;
  348.     }
  349.     /** @return Collection|AutrePaiement[] */
  350.     public function getAutrePaiementsClient(): Collection
  351.     {
  352.         return $this->autrePaiementsClient;
  353.     }
  354.     public function addAutrePaiementsClient(AutrePaiement $autrePaiement): self
  355.     {
  356.         if (!$this->autrePaiementsClient->contains($autrePaiement)) {
  357.             $this->autrePaiementsClient[] = $autrePaiement;
  358.             $autrePaiement->setClient($this);
  359.         }
  360.         return $this;
  361.     }
  362.     public function removeAutrePaiementsClient(AutrePaiement $autrePaiement): self
  363.     {
  364.         if ($this->autrePaiementsClient->removeElement($autrePaiement)) {
  365.             if ($autrePaiement->getClient() === $this) {
  366.                 $autrePaiement->setClient(null);
  367.             }
  368.         }
  369.         return $this;
  370.     }
  371.     public function getTokenFlutter(): ?string { return $this->tokenFlutter; }
  372.     public function setTokenFlutter(?string $tokenFlutter): self { $this->tokenFlutter = $tokenFlutter; return $this; }
  373.     public function getContactWhatsapp(): ?string { return $this->contactWhatsapp; }
  374.     public function setContactWhatsapp(?string $contactWhatsapp): self { $this->contactWhatsapp = $contactWhatsapp; return $this; }
  375.     public function getVille(): ?Ville { return $this->ville; }
  376.     public function setVille(?Ville $ville): self { $this->ville = $ville; return $this; }
  377.     public function getUtilisateur(): ?Utilisateur { return $this->utilisateur; }
  378.     public function setUtilisateur(?Utilisateur $utilisateur): self
  379.     {
  380.         if ($utilisateur === null && $this->utilisateur !== null) {
  381.             $this->utilisateur->setIdAg(null);
  382.         }
  383.         if ($utilisateur !== null && $utilisateur->getIdAg() !== $this) {
  384.             $utilisateur->setIdAg($this);
  385.         }
  386.         $this->utilisateur = $utilisateur;
  387.         return $this;
  388.     }
  389.     public function getCode(): ?int { return $this->code; }
  390.     public function setCode(int $code): self { $this->code = $code; return $this; }
  391.     public function getPrefixcode(): ?string { return $this->prefixcode; }
  392.     public function setPrefixcode(string $prefixcode): self { $this->prefixcode = $prefixcode; return $this; }
  393.     public function getLangue(): ?string { return $this->langue; }
  394.     public function setLangue(string $langue): self { $this->langue = $langue; return $this; }
  395.     public function isMco(): ?bool { return $this->mco; }
  396.     public function setMco(bool $mco): self { $this->mco = $mco; return $this; }
  397.     public function isAncien(): ?bool { return $this->ancien; }
  398.     public function setAncien(bool $ancien): self { $this->ancien = $ancien; return $this; }
  399.     public function isCargoAgent(): ?bool { return $this->cargoAgent; }
  400.     public function setCargoAgent(bool $cargoAgent): self { $this->cargoAgent = $cargoAgent; return $this; }
  401.     public function isIsVerifier(): ?bool { return $this->isVerifier; }
  402.     public function setIsVerifier(bool $isVerifier): self { $this->isVerifier = $isVerifier; return $this; }
  403.     public function getCodeverification(): ?string { return $this->codeverification; }
  404.     public function setCodeverification(string $codeverification): self { $this->codeverification = $codeverification; return $this; }
  405.     public function getClientblocker(): ?string { return $this->clientblocker; }
  406.     public function setClientblocker(string $clientblocker): self { $this->clientblocker = $clientblocker; return $this; }
  407.     public function getAdmin(): ?string { return $this->admin; }
  408.     public function setAdmin(string $admin): self { $this->admin = $admin; return $this; }
  409.     /**
  410.      * @return Collection|ProgrammeContenaire[]
  411.      */
  412.     public function getProgrammeContenaireGestionnaire(): Collection
  413.     {
  414.         return $this->programmeContenaireGestionnaire;
  415.     }
  416.     public function addProgrammeContenaireGestionnaire(ProgrammeContenaire $programme): self
  417.     {
  418.         if (!$this->programmeContenaireGestionnaire->contains($programme)) {
  419.             $this->programmeContenaireGestionnaire[] = $programme;
  420.             $programme->setAgentGestionnaire($this);
  421.         }
  422.         return $this;
  423.     }
  424.     public function removeProgrammeContenaireGestionnaire(ProgrammeContenaire $programme): self
  425.     {
  426.         if ($this->programmeContenaireGestionnaire->removeElement($programme)) {
  427.             if ($programme->getAgentGestionnaire() === $this) {
  428.                 $programme->setAgentGestionnaire(null);
  429.             }
  430.         }
  431.         return $this;
  432.     }
  433.     public function getFaceSignature(): ?array
  434.     {
  435.         return $this->faceSignature;
  436.     }
  437.     public function setFaceSignature(?array $faceSignature): self
  438.     {
  439.         $this->faceSignature = $faceSignature;
  440.         return $this;
  441.     }
  442.     /**
  443.      * @return Collection|Attendance[]
  444.      */
  445.     public function getAttendances(): Collection
  446.     {
  447.         return $this->attendances;
  448.     }
  449.     public function addAttendance(Attendance $attendance): self
  450.     {
  451.         if (!$this->attendances->contains($attendance)) {
  452.             $this->attendances[] = $attendance;
  453.             $attendance->setAgent($this);
  454.         }
  455.         return $this;
  456.     }
  457.     public function removeAttendance(Attendance $attendance): self
  458.     {
  459.         if ($this->attendances->removeElement($attendance)) {
  460.             if ($attendance->getAgent() === $this) {
  461.                 $attendance->setAgent(null);
  462.             }
  463.         }
  464.         return $this;
  465.     }
  466. }