src/Entity/ClientCompte.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use App\Repository\ClientCompteRepository;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\Common\Collections\ArrayCollection;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  9. /**
  10.  * @ORM\Entity(repositoryClass=ClientCompteRepository::class)
  11.  */
  12. class ClientCompte implements UserInterfacePasswordAuthenticatedUserInterface
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=255)
  22.      */
  23.     private $cli_username;
  24.     /**
  25.      * @ORM\Column(type="boolean")
  26.      */
  27.     private $cli_is_active;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $cli_password;
  32.     /**
  33.      * @ORM\Column(type="string", length=255, nullable=true)
  34.      */
  35.     private $cli_salt;
  36.     /**
  37.      * @ORM\Column(type="string", length=50, nullable=true)
  38.      */
  39.     private $cli_nom_societe;
  40.     /**
  41.      * @ORM\Column(type="string", length=50, nullable=true)
  42.      */
  43.     private $cli_nom;
  44.     /**
  45.      * @ORM\Column(type="string", length=50, nullable=true)
  46.      */
  47.     private $cli_prenom;
  48.     /**
  49.      * @ORM\Column(type="string", length=50)
  50.      */
  51.     private $cli_email;
  52.     /**
  53.      * @ORM\Column(type="string", length=50)
  54.      */
  55.     private $cli_telephone;
  56.     /**
  57.      * @ORM\Column(type="string", length=50, nullable=true)
  58.      */
  59.     private $cli_telephone_2;
  60.     /**
  61.      * @ORM\Column(type="string", length=50, nullable=true)
  62.      */
  63.     private $cli_fax;
  64.     /**
  65.      * @ORM\Column(type="string", length=50, nullable=true)
  66.      */
  67.     private $cli_tva;
  68.     /**
  69.      * @ORM\Column(type="string", length=50, nullable=true)
  70.      */
  71.     private $cli_siren;
  72.     /**
  73.      * @ORM\Column(type="string", length=50, nullable=true)
  74.      */
  75.     private $cli_cpl;
  76.     /**
  77.      * @ORM\Column(type="integer", nullable=true)
  78.      */
  79.     private $cli_nb_jour_alerte_echeance_1;
  80.     /**
  81.      * @ORM\Column(type="integer", nullable=true)
  82.      */
  83.     private $cli_nb_jour_alerte_echeance_2;
  84.     /**
  85.      * @ORM\Column(type="integer", nullable=true)
  86.      */
  87.     private $cli_nb_jour_alerte_echeance_3;
  88.     /**
  89.      * @ORM\Column(type="integer", nullable=true)
  90.      */
  91.     private $cli_nb_jour_alerte_echeance_sms_1;
  92.     /**
  93.      * @ORM\Column(type="integer", nullable=true)
  94.      */
  95.     private $cli_nb_jour_alerte_echeance_sms_2;
  96.     /**
  97.      * @ORM\Column(type="integer", nullable=true)
  98.      */
  99.     private $cli_nb_jour_alerte_echeance_sms_3;
  100.     /**
  101.      * @ORM\Column(type="string", length=50, nullable=true)
  102.      */
  103.     private $cli_contact_1_nom;
  104.     /**
  105.      * @ORM\Column(type="string", length=50, nullable=true)
  106.      */
  107.     private $cli_contact_1_prenom;
  108.     /**
  109.      * @ORM\Column(type="string", length=50, nullable=true)
  110.      */
  111.     private $cli_contact_1_email;
  112.     /**
  113.      * @ORM\Column(type="string", length=50, nullable=true)
  114.      */
  115.     private $cli_contact_1_telephone;
  116.     /**
  117.      * @ORM\Column(type="string", length=50, nullable=true)
  118.      */
  119.     private $cli_contact_2_nom;
  120.     /**
  121.      * @ORM\Column(type="string", length=50, nullable=true)
  122.      */
  123.     private $cli_contact_2_prenom;
  124.     /**
  125.      * @ORM\Column(type="string", length=50, nullable=true)
  126.      */
  127.     private $cli_contact_2_email;
  128.     /**
  129.      * @ORM\Column(type="string", length=50, nullable=true)
  130.      */
  131.     private $cli_contact_2_telephone;
  132.     /**
  133.      * @ORM\Column(type="boolean")
  134.      */
  135.     private $cli_has_pro_access;
  136.     /**
  137.      * @ORM\OneToMany(targetEntity=Rendezvous::class, mappedBy="client_compte")
  138.      */
  139.     private $rendezvouses;
  140.     /**
  141.      * @ORM\OneToMany(targetEntity=RendezVousVehicule::class, mappedBy="client_compte", fetch="EAGER")
  142.      */
  143.     private $rendezVousVehicules;
  144.     /**
  145.      * @ORM\ManyToOne(targetEntity=Adresse::class, inversedBy="clientComptes", fetch="EAGER")
  146.      * @ORM\JoinColumn(nullable=true)
  147.      */
  148.     private $adresse;
  149.     /**
  150.      * @ORM\ManyToOne(targetEntity=Adresse::class, inversedBy="clientComptes", fetch="EAGER")
  151.      * @ORM\JoinColumn(nullable=true)
  152.      */
  153.     private $adresse_facturation;
  154.     /**
  155.      * @ORM\ManyToOne(targetEntity=CentreGroupe::class, inversedBy="clientComptes")
  156.      * @ORM\JoinColumn(nullable=false)
  157.      */
  158.     private $centre_groupe;
  159.     /**
  160.      * @ORM\ManyToOne(targetEntity=CentreType::class, inversedBy="clientComptes", fetch="EAGER")
  161.      * @ORM\JoinColumn(nullable=true)
  162.      */
  163.     private $centre_type;
  164.     /**
  165.      * @ORM\Column(type="integer", nullable=true)
  166.      */
  167.     private $id_old;
  168.     /**
  169.      * @ORM\Column(type="boolean", nullable=true)
  170.      */
  171.     private $cli_vl;
  172.     /**
  173.      * @ORM\Column(type="boolean", nullable=true)
  174.      */
  175.     private $cli_pl;
  176.     /**
  177.      * @ORM\Column(type="boolean", nullable=true)
  178.      */
  179.     private $cli_cl;
  180.  
  181.     public function __construct()
  182.     {
  183.         $this->rendezvouses = new ArrayCollection();
  184.         $this->rendezVousVehicules = new ArrayCollection();
  185.     }
  186.     public function getId(): ?int
  187.     {
  188.         return $this->id;
  189.     }
  190.     // Partie Authentification
  191.     public function getRoles(): array
  192.     {
  193.        
  194.         // we need to make sure to have at least one role
  195.         if (empty($roles)) {
  196.             $roles[] = 'ROLE_PRO';
  197.         }
  198.         return array_unique($roles);
  199.     }
  200.     public function getUserIdentifier(): string
  201.     {
  202.         return (string) $this->cli_email;
  203.     }
  204.        public function getPassword(): string
  205.     {
  206.         return $this->cli_password;
  207.     }
  208.     public function setPassword(string $cli_password): self
  209.     {
  210.         $this->cli_password $cli_password;
  211.         return $this;
  212.     }
  213.     public function getSalt()
  214.     {
  215.         // on ne va pas utiliser de sel (salt) car on utilise bcrypt pour le hashage du mot de passe
  216.         // bcrypt inclus déjà un sel aléatoire
  217.         return null;
  218.     }
  219.     public function getUsername()
  220.     {
  221.         return $this->cli_email// retourne le nom de l'utilisateur comme identifiant
  222.     }
  223.     public function eraseCredentials()
  224.     {
  225.         // rien à faire ici, car on ne stocke pas les mots de passe en clair
  226.         // si vous stockez les mots de passe en clair, vous devriez les effacer ici
  227.     }
  228.     public function getCliUsername(): ?string
  229.     {
  230.         return $this->cli_username;
  231.     }
  232.     public function setCliUsername(string $cli_username): self
  233.     {
  234.         $this->cli_username $cli_username;
  235.         return $this;
  236.     }
  237.     public function isCliIsActive(): ?bool
  238.     {
  239.         return $this->cli_is_active;
  240.     }
  241.     public function setCliIsActive(bool $cli_is_active): self
  242.     {
  243.         $this->cli_is_active $cli_is_active;
  244.         return $this;
  245.     }
  246.     public function getCliPassword(): ?string
  247.     {
  248.         return $this->cli_password;
  249.     }
  250.     public function setCliPassword(string $cli_password): self
  251.     {
  252.         $this->cli_password $cli_password;
  253.         return $this;
  254.     }
  255.     public function getCliSalt(): ?string
  256.     {
  257.         return $this->cli_salt;
  258.     }
  259.     public function setCliSalt(string $cli_salt): self
  260.     {
  261.         $this->cli_salt $cli_salt;
  262.         return $this;
  263.     }
  264.     public function getCliNomSociete(): ?string
  265.     {
  266.         return $this->cli_nom_societe;
  267.     }
  268.     public function setCliNomSociete(?string $cli_nom_societe): self
  269.     {
  270.         $this->cli_nom_societe strtoupper($cli_nom_societe);
  271.         return $this;
  272.     }
  273.     public function getCliNom(): ?string
  274.     {
  275.         return $this->cli_nom;
  276.     }
  277.     public function setCliNom(?string $cli_nom): self
  278.     {
  279.         $this->cli_nom strtoupper($cli_nom);
  280.         return $this;
  281.     }
  282.     public function getCliPrenom(): ?string
  283.     {
  284.         return $this->cli_prenom;
  285.     }
  286.     public function setCliPrenom(?string $cli_prenom): self
  287.     {
  288.         $this->cli_prenom ucfirst($cli_prenom);
  289.         return $this;
  290.     }
  291.     public function getCliEmail(): ?string
  292.     {
  293.         return $this->cli_email;
  294.     }
  295.     public function setCliEmail(string $cli_email): self
  296.     {
  297.         $this->cli_email strtolower($cli_email);
  298.         return $this;
  299.     }
  300.     public function getCliTelephone(): ?string
  301.     {
  302.         return $this->cli_telephone;
  303.     }
  304.     public function setCliTelephone(string $cli_telephone): self
  305.     {
  306.         $this->cli_telephone preg_replace('/\D/'''$cli_telephone);
  307.         return $this;
  308.     }
  309.     public function getCliTelephone2(): ?string
  310.     {
  311.         return $this->cli_telephone_2;
  312.     }
  313.     public function setCliTelephone2(?string $cli_telephone_2): self
  314.     {
  315.         $this->cli_telephone_2 preg_replace('/\D/'''$cli_telephone_2);
  316.         return $this;
  317.     }
  318.     public function getCliFax(): ?string
  319.     {
  320.         return $this->cli_fax;
  321.     }
  322.     public function setCliFax(?string $cli_fax): self
  323.     {
  324.         $this->cli_fax preg_replace('/\D/'''$cli_fax);
  325.         return $this;
  326.     }
  327.     public function getCliTva(): ?string
  328.     {
  329.         return $this->cli_tva;
  330.     }
  331.     public function setCliTva(?string $cli_tva): self
  332.     {
  333.         $this->cli_tva $cli_tva;
  334.         return $this;
  335.     }
  336.     public function getCliSiren(): ?string
  337.     {
  338.         return $this->cli_siren;
  339.     }
  340.     public function setCliSiren(?string $cli_siren): self
  341.     {
  342.         $this->cli_siren $cli_siren;
  343.         return $this;
  344.     }
  345.     public function getCliCpl(): ?string
  346.     {
  347.         return $this->cli_cpl;
  348.     }
  349.     public function setCliCpl(?string $cli_cpl): self
  350.     {
  351.         $this->cli_cpl $cli_cpl;
  352.         return $this;
  353.     }
  354.     public function getCliNbJourAlerteEcheance1(): ?int
  355.     {
  356.         return $this->cli_nb_jour_alerte_echeance_1;
  357.     }
  358.     public function setCliNbJourAlerteEcheance1(?int $cli_nb_jour_alerte_echeance_1): self
  359.     {
  360.         $this->cli_nb_jour_alerte_echeance_1 $cli_nb_jour_alerte_echeance_1;
  361.         return $this;
  362.     }
  363.     public function getCliNbJourAlerteEcheance2(): ?int
  364.     {
  365.         return $this->cli_nb_jour_alerte_echeance_2;
  366.     }
  367.     public function setCliNbJourAlerteEcheance2(?int $cli_nb_jour_alerte_echeance_2): self
  368.     {
  369.         $this->cli_nb_jour_alerte_echeance_2 $cli_nb_jour_alerte_echeance_2;
  370.         return $this;
  371.     }
  372.     public function getCliNbJourAlerteEcheance3(): ?int
  373.     {
  374.         return $this->cli_nb_jour_alerte_echeance_3;
  375.     }
  376.     public function setCliNbJourAlerteEcheance3(?int $cli_nb_jour_alerte_echeance_3): self
  377.     {
  378.         $this->cli_nb_jour_alerte_echeance_3 $cli_nb_jour_alerte_echeance_3;
  379.         return $this;
  380.     }
  381.     public function getCliNbJourAlerteEcheanceSms1(): ?int
  382.     {
  383.         return $this->cli_nb_jour_alerte_echeance_sms_1;
  384.     }
  385.     public function setCliNbJourAlerteEcheanceSms1(?int $cli_nb_jour_alerte_echeance_sms_1): self
  386.     {
  387.         $this->cli_nb_jour_alerte_echeance_sms_1 $cli_nb_jour_alerte_echeance_sms_1;
  388.         return $this;
  389.     }
  390.     public function getCliNbJourAlerteEcheanceSms2(): ?int
  391.     {
  392.         return $this->cli_nb_jour_alerte_echeance_sms_2;
  393.     }
  394.     public function setCliNbJourAlerteEcheanceSms2(?int $cli_nb_jour_alerte_echeance_sms_2): self
  395.     {
  396.         $this->cli_nb_jour_alerte_echeance_sms_2 $cli_nb_jour_alerte_echeance_sms_2;
  397.         return $this;
  398.     }
  399.     public function getCliNbJourAlerteEcheanceSms3(): ?int
  400.     {
  401.         return $this->cli_nb_jour_alerte_echeance_sms_3;
  402.     }
  403.     public function setCliNbJourAlerteEcheanceSms3(?int $cli_nb_jour_alerte_echeance_sms_3): self
  404.     {
  405.         $this->cli_nb_jour_alerte_echeance_sms_3 $cli_nb_jour_alerte_echeance_sms_3;
  406.         return $this;
  407.     }
  408.     public function getCliContact1Nom(): ?string
  409.     {
  410.         return $this->cli_contact_1_nom;
  411.     }
  412.     public function setCliContact1Nom(?string $cli_contact_1_nom): self
  413.     {
  414.         $this->cli_contact_1_nom $cli_contact_1_nom;
  415.         return $this;
  416.     }
  417.     public function getCliContact1Prenom(): ?string
  418.     {
  419.         return $this->cli_contact_1_prenom;
  420.     }
  421.     public function setCliContact1Prenom(?string $cli_contact_1_prenom): self
  422.     {
  423.         $this->cli_contact_1_prenom $cli_contact_1_prenom;
  424.         return $this;
  425.     }
  426.     public function getCliContact1Email(): ?string
  427.     {
  428.         return $this->cli_contact_1_email;
  429.     }
  430.     public function setCliContact1Email(?string $cli_contact_1_email): self
  431.     {
  432.         $this->cli_contact_1_email $cli_contact_1_email;
  433.         return $this;
  434.     }
  435.     public function getCliContact1Telephone(): ?string
  436.     {
  437.         return $this->cli_contact_1_telephone;
  438.     }
  439.     public function setCliContact1Telephone(?string $cli_contact_1_telephone): self
  440.     {
  441.         $this->cli_contact_1_telephone $cli_contact_1_telephone;
  442.         return $this;
  443.     }
  444.     public function getCliContact2Nom(): ?string
  445.     {
  446.         return $this->cli_contact_2_nom;
  447.     }
  448.     public function setCliContact2Nom(?string $cli_contact_2_nom): self
  449.     {
  450.         $this->cli_contact_2_nom $cli_contact_2_nom;
  451.         return $this;
  452.     }
  453.     public function getCliContact2Prenom(): ?string
  454.     {
  455.         return $this->cli_contact_2_prenom;
  456.     }
  457.     public function setCliContact2Prenom(?string $cli_contact_2_prenom): self
  458.     {
  459.         $this->cli_contact_2_prenom $cli_contact_2_prenom;
  460.         return $this;
  461.     }
  462.     public function getCliContact2Email(): ?string
  463.     {
  464.         return $this->cli_contact_2_email;
  465.     }
  466.     public function setCliContact2Email(?string $cli_contact_2_email): self
  467.     {
  468.         $this->cli_contact_2_email $cli_contact_2_email;
  469.         return $this;
  470.     }
  471.     public function getCliContact2Telephone(): ?string
  472.     {
  473.         return $this->cli_contact_2_telephone;
  474.     }
  475.     public function setCliContact2Telephone(?string $cli_contact_2_telephone): self
  476.     {
  477.         $this->cli_contact_2_telephone $cli_contact_2_telephone;
  478.         return $this;
  479.     }
  480.     public function getCliHasProAccess(): ?bool
  481.     {
  482.         return $this->cli_has_pro_access;
  483.     }
  484.     public function setCliHasProAccess(bool $cli_has_pro_access): self
  485.     {
  486.         $this->cli_has_pro_access $cli_has_pro_access;
  487.         return $this;
  488.     }
  489.     /**
  490.      * @return Collection<int, Rendezvous>
  491.      */
  492.     public function getRendezvouses(): Collection
  493.     {
  494.         return $this->rendezvouses;
  495.     }
  496.     public function addRendezvouse(Rendezvous $rendezvouse): self
  497.     {
  498.         if (!$this->rendezvouses->contains($rendezvouse)) {
  499.             $this->rendezvouses[] = $rendezvouse;
  500.             $rendezvouse->setClientCompte($this);
  501.         }
  502.         return $this;
  503.     }
  504.     public function removeRendezvouse(Rendezvous $rendezvouse): self
  505.     {
  506.         if ($this->rendezvouses->removeElement($rendezvouse)) {
  507.             // set the owning side to null (unless already changed)
  508.             if ($rendezvouse->getClientCompte() === $this) {
  509.                 $rendezvouse->setClientCompte(null);
  510.             }
  511.         }
  512.         return $this;
  513.     }
  514.     /**
  515.      * @return Collection<int, RendezVousVehicule>
  516.      */
  517.     public function getRendezVousVehicules(): Collection
  518.     {
  519.         return $this->rendezVousVehicules;
  520.     }
  521.     public function addRendezVousVehicule(RendezVousVehicule $rendezVousVehicule): self
  522.     {
  523.         if (!$this->rendezVousVehicules->contains($rendezVousVehicule)) {
  524.             $this->rendezVousVehicules[] = $rendezVousVehicule;
  525.             $rendezVousVehicule->setClientCompte($this);
  526.         }
  527.         return $this;
  528.     }
  529.     public function removeRendezVousVehicule(RendezVousVehicule $rendezVousVehicule): self
  530.     {
  531.         if ($this->rendezVousVehicules->removeElement($rendezVousVehicule)) {
  532.             // set the owning side to null (unless already changed)
  533.             if ($rendezVousVehicule->getClientCompte() === $this) {
  534.                 $rendezVousVehicule->setClientCompte(null);
  535.             }
  536.         }
  537.         return $this;
  538.     }
  539.     public function getAdresse(): ?Adresse
  540.     {
  541.         return $this->adresse;
  542.     }
  543.     public function setAdresse(?Adresse $adresse): self
  544.     {
  545.         $this->adresse $adresse;
  546.         return $this;
  547.     }
  548.     public function getAdresseFacturation(): ?Adresse
  549.     {
  550.         return $this->adresse_facturation;
  551.     }
  552.     public function setAdresseFacturation(?Adresse $adresse_facturation): self
  553.     {
  554.         $this->adresse_facturation $adresse_facturation;
  555.         return $this;
  556.     }
  557.     public function getCentreGroupe(): ?CentreGroupe
  558.     {
  559.         return $this->centre_groupe;
  560.     }
  561.     public function setCentreGroupe(?CentreGroupe $centre_groupe): self
  562.     {
  563.         $this->centre_groupe $centre_groupe;
  564.         return $this;
  565.     }
  566.     public function getCentreType(): ?CentreType
  567.     {
  568.         return $this->centre_type;
  569.     }
  570.     public function setCentreType(?CentreType $centre_type): self
  571.     {
  572.         $this->centre_type $centre_type;
  573.         return $this;
  574.     }
  575.     public function getIdOld(): ?int
  576.     {
  577.         return $this->id_old;
  578.     }
  579.     public function setIdOld(?int $id_old): self
  580.     {
  581.         $this->id_old $id_old;
  582.         return $this;
  583.     }
  584.     public function isCliHasProAccess(): ?bool
  585.     {
  586.         return $this->cli_has_pro_access;
  587.     }
  588.     public function isCliVl(): ?bool
  589.     {
  590.         return $this->cli_vl;
  591.     }
  592.     public function setCliVl(?bool $cli_vl): self
  593.     {
  594.         $this->cli_vl $cli_vl;
  595.         return $this;
  596.     }
  597.     public function isCliPl(): ?bool
  598.     {
  599.         return $this->cli_pl;
  600.     }
  601.     public function setCliPl(?bool $cli_pl): self
  602.     {
  603.         $this->cli_pl $cli_pl;
  604.         return $this;
  605.     }
  606.     public function isCliCl(): ?bool
  607.     {
  608.         return $this->cli_cl;
  609.     }
  610.     public function setCliCl(?bool $cli_cl): self
  611.     {
  612.         $this->cli_cl $cli_cl;
  613.         return $this;
  614.     }
  615. }