<?php
namespace App\Entity;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\ClientCompteRepository;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
/**
* @ORM\Entity(repositoryClass=ClientCompteRepository::class)
*/
class ClientCompte implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $cli_username;
/**
* @ORM\Column(type="boolean")
*/
private $cli_is_active;
/**
* @ORM\Column(type="string", length=255)
*/
private $cli_password;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $cli_salt;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_nom_societe;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_nom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_prenom;
/**
* @ORM\Column(type="string", length=50)
*/
private $cli_email;
/**
* @ORM\Column(type="string", length=50)
*/
private $cli_telephone;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_telephone_2;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_fax;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_tva;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_siren;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_cpl;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $cli_nb_jour_alerte_echeance_1;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $cli_nb_jour_alerte_echeance_2;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $cli_nb_jour_alerte_echeance_3;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $cli_nb_jour_alerte_echeance_sms_1;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $cli_nb_jour_alerte_echeance_sms_2;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $cli_nb_jour_alerte_echeance_sms_3;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_1_nom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_1_prenom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_1_email;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_1_telephone;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_2_nom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_2_prenom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_2_email;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cli_contact_2_telephone;
/**
* @ORM\Column(type="boolean")
*/
private $cli_has_pro_access;
/**
* @ORM\OneToMany(targetEntity=Rendezvous::class, mappedBy="client_compte")
*/
private $rendezvouses;
/**
* @ORM\OneToMany(targetEntity=RendezVousVehicule::class, mappedBy="client_compte", fetch="EAGER")
*/
private $rendezVousVehicules;
/**
* @ORM\ManyToOne(targetEntity=Adresse::class, inversedBy="clientComptes", fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $adresse;
/**
* @ORM\ManyToOne(targetEntity=Adresse::class, inversedBy="clientComptes", fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $adresse_facturation;
/**
* @ORM\ManyToOne(targetEntity=CentreGroupe::class, inversedBy="clientComptes")
* @ORM\JoinColumn(nullable=false)
*/
private $centre_groupe;
/**
* @ORM\ManyToOne(targetEntity=CentreType::class, inversedBy="clientComptes", fetch="EAGER")
* @ORM\JoinColumn(nullable=true)
*/
private $centre_type;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $id_old;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $cli_vl;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $cli_pl;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $cli_cl;
public function __construct()
{
$this->rendezvouses = new ArrayCollection();
$this->rendezVousVehicules = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
// Partie Authentification
public function getRoles(): array
{
// we need to make sure to have at least one role
if (empty($roles)) {
$roles[] = 'ROLE_PRO';
}
return array_unique($roles);
}
public function getUserIdentifier(): string
{
return (string) $this->cli_email;
}
public function getPassword(): string
{
return $this->cli_password;
}
public function setPassword(string $cli_password): self
{
$this->cli_password = $cli_password;
return $this;
}
public function getSalt()
{
// on ne va pas utiliser de sel (salt) car on utilise bcrypt pour le hashage du mot de passe
// bcrypt inclus déjà un sel aléatoire
return null;
}
public function getUsername()
{
return $this->cli_email; // retourne le nom de l'utilisateur comme identifiant
}
public function eraseCredentials()
{
// rien à faire ici, car on ne stocke pas les mots de passe en clair
// si vous stockez les mots de passe en clair, vous devriez les effacer ici
}
public function getCliUsername(): ?string
{
return $this->cli_username;
}
public function setCliUsername(string $cli_username): self
{
$this->cli_username = $cli_username;
return $this;
}
public function isCliIsActive(): ?bool
{
return $this->cli_is_active;
}
public function setCliIsActive(bool $cli_is_active): self
{
$this->cli_is_active = $cli_is_active;
return $this;
}
public function getCliPassword(): ?string
{
return $this->cli_password;
}
public function setCliPassword(string $cli_password): self
{
$this->cli_password = $cli_password;
return $this;
}
public function getCliSalt(): ?string
{
return $this->cli_salt;
}
public function setCliSalt(string $cli_salt): self
{
$this->cli_salt = $cli_salt;
return $this;
}
public function getCliNomSociete(): ?string
{
return $this->cli_nom_societe;
}
public function setCliNomSociete(?string $cli_nom_societe): self
{
$this->cli_nom_societe = strtoupper($cli_nom_societe);
return $this;
}
public function getCliNom(): ?string
{
return $this->cli_nom;
}
public function setCliNom(?string $cli_nom): self
{
$this->cli_nom = strtoupper($cli_nom);
return $this;
}
public function getCliPrenom(): ?string
{
return $this->cli_prenom;
}
public function setCliPrenom(?string $cli_prenom): self
{
$this->cli_prenom = ucfirst($cli_prenom);
return $this;
}
public function getCliEmail(): ?string
{
return $this->cli_email;
}
public function setCliEmail(string $cli_email): self
{
$this->cli_email = strtolower($cli_email);
return $this;
}
public function getCliTelephone(): ?string
{
return $this->cli_telephone;
}
public function setCliTelephone(string $cli_telephone): self
{
$this->cli_telephone = preg_replace('/\D/', '', $cli_telephone);
return $this;
}
public function getCliTelephone2(): ?string
{
return $this->cli_telephone_2;
}
public function setCliTelephone2(?string $cli_telephone_2): self
{
$this->cli_telephone_2 = preg_replace('/\D/', '', $cli_telephone_2);
return $this;
}
public function getCliFax(): ?string
{
return $this->cli_fax;
}
public function setCliFax(?string $cli_fax): self
{
$this->cli_fax = preg_replace('/\D/', '', $cli_fax);
return $this;
}
public function getCliTva(): ?string
{
return $this->cli_tva;
}
public function setCliTva(?string $cli_tva): self
{
$this->cli_tva = $cli_tva;
return $this;
}
public function getCliSiren(): ?string
{
return $this->cli_siren;
}
public function setCliSiren(?string $cli_siren): self
{
$this->cli_siren = $cli_siren;
return $this;
}
public function getCliCpl(): ?string
{
return $this->cli_cpl;
}
public function setCliCpl(?string $cli_cpl): self
{
$this->cli_cpl = $cli_cpl;
return $this;
}
public function getCliNbJourAlerteEcheance1(): ?int
{
return $this->cli_nb_jour_alerte_echeance_1;
}
public function setCliNbJourAlerteEcheance1(?int $cli_nb_jour_alerte_echeance_1): self
{
$this->cli_nb_jour_alerte_echeance_1 = $cli_nb_jour_alerte_echeance_1;
return $this;
}
public function getCliNbJourAlerteEcheance2(): ?int
{
return $this->cli_nb_jour_alerte_echeance_2;
}
public function setCliNbJourAlerteEcheance2(?int $cli_nb_jour_alerte_echeance_2): self
{
$this->cli_nb_jour_alerte_echeance_2 = $cli_nb_jour_alerte_echeance_2;
return $this;
}
public function getCliNbJourAlerteEcheance3(): ?int
{
return $this->cli_nb_jour_alerte_echeance_3;
}
public function setCliNbJourAlerteEcheance3(?int $cli_nb_jour_alerte_echeance_3): self
{
$this->cli_nb_jour_alerte_echeance_3 = $cli_nb_jour_alerte_echeance_3;
return $this;
}
public function getCliNbJourAlerteEcheanceSms1(): ?int
{
return $this->cli_nb_jour_alerte_echeance_sms_1;
}
public function setCliNbJourAlerteEcheanceSms1(?int $cli_nb_jour_alerte_echeance_sms_1): self
{
$this->cli_nb_jour_alerte_echeance_sms_1 = $cli_nb_jour_alerte_echeance_sms_1;
return $this;
}
public function getCliNbJourAlerteEcheanceSms2(): ?int
{
return $this->cli_nb_jour_alerte_echeance_sms_2;
}
public function setCliNbJourAlerteEcheanceSms2(?int $cli_nb_jour_alerte_echeance_sms_2): self
{
$this->cli_nb_jour_alerte_echeance_sms_2 = $cli_nb_jour_alerte_echeance_sms_2;
return $this;
}
public function getCliNbJourAlerteEcheanceSms3(): ?int
{
return $this->cli_nb_jour_alerte_echeance_sms_3;
}
public function setCliNbJourAlerteEcheanceSms3(?int $cli_nb_jour_alerte_echeance_sms_3): self
{
$this->cli_nb_jour_alerte_echeance_sms_3 = $cli_nb_jour_alerte_echeance_sms_3;
return $this;
}
public function getCliContact1Nom(): ?string
{
return $this->cli_contact_1_nom;
}
public function setCliContact1Nom(?string $cli_contact_1_nom): self
{
$this->cli_contact_1_nom = $cli_contact_1_nom;
return $this;
}
public function getCliContact1Prenom(): ?string
{
return $this->cli_contact_1_prenom;
}
public function setCliContact1Prenom(?string $cli_contact_1_prenom): self
{
$this->cli_contact_1_prenom = $cli_contact_1_prenom;
return $this;
}
public function getCliContact1Email(): ?string
{
return $this->cli_contact_1_email;
}
public function setCliContact1Email(?string $cli_contact_1_email): self
{
$this->cli_contact_1_email = $cli_contact_1_email;
return $this;
}
public function getCliContact1Telephone(): ?string
{
return $this->cli_contact_1_telephone;
}
public function setCliContact1Telephone(?string $cli_contact_1_telephone): self
{
$this->cli_contact_1_telephone = $cli_contact_1_telephone;
return $this;
}
public function getCliContact2Nom(): ?string
{
return $this->cli_contact_2_nom;
}
public function setCliContact2Nom(?string $cli_contact_2_nom): self
{
$this->cli_contact_2_nom = $cli_contact_2_nom;
return $this;
}
public function getCliContact2Prenom(): ?string
{
return $this->cli_contact_2_prenom;
}
public function setCliContact2Prenom(?string $cli_contact_2_prenom): self
{
$this->cli_contact_2_prenom = $cli_contact_2_prenom;
return $this;
}
public function getCliContact2Email(): ?string
{
return $this->cli_contact_2_email;
}
public function setCliContact2Email(?string $cli_contact_2_email): self
{
$this->cli_contact_2_email = $cli_contact_2_email;
return $this;
}
public function getCliContact2Telephone(): ?string
{
return $this->cli_contact_2_telephone;
}
public function setCliContact2Telephone(?string $cli_contact_2_telephone): self
{
$this->cli_contact_2_telephone = $cli_contact_2_telephone;
return $this;
}
public function getCliHasProAccess(): ?bool
{
return $this->cli_has_pro_access;
}
public function setCliHasProAccess(bool $cli_has_pro_access): self
{
$this->cli_has_pro_access = $cli_has_pro_access;
return $this;
}
/**
* @return Collection<int, Rendezvous>
*/
public function getRendezvouses(): Collection
{
return $this->rendezvouses;
}
public function addRendezvouse(Rendezvous $rendezvouse): self
{
if (!$this->rendezvouses->contains($rendezvouse)) {
$this->rendezvouses[] = $rendezvouse;
$rendezvouse->setClientCompte($this);
}
return $this;
}
public function removeRendezvouse(Rendezvous $rendezvouse): self
{
if ($this->rendezvouses->removeElement($rendezvouse)) {
// set the owning side to null (unless already changed)
if ($rendezvouse->getClientCompte() === $this) {
$rendezvouse->setClientCompte(null);
}
}
return $this;
}
/**
* @return Collection<int, RendezVousVehicule>
*/
public function getRendezVousVehicules(): Collection
{
return $this->rendezVousVehicules;
}
public function addRendezVousVehicule(RendezVousVehicule $rendezVousVehicule): self
{
if (!$this->rendezVousVehicules->contains($rendezVousVehicule)) {
$this->rendezVousVehicules[] = $rendezVousVehicule;
$rendezVousVehicule->setClientCompte($this);
}
return $this;
}
public function removeRendezVousVehicule(RendezVousVehicule $rendezVousVehicule): self
{
if ($this->rendezVousVehicules->removeElement($rendezVousVehicule)) {
// set the owning side to null (unless already changed)
if ($rendezVousVehicule->getClientCompte() === $this) {
$rendezVousVehicule->setClientCompte(null);
}
}
return $this;
}
public function getAdresse(): ?Adresse
{
return $this->adresse;
}
public function setAdresse(?Adresse $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getAdresseFacturation(): ?Adresse
{
return $this->adresse_facturation;
}
public function setAdresseFacturation(?Adresse $adresse_facturation): self
{
$this->adresse_facturation = $adresse_facturation;
return $this;
}
public function getCentreGroupe(): ?CentreGroupe
{
return $this->centre_groupe;
}
public function setCentreGroupe(?CentreGroupe $centre_groupe): self
{
$this->centre_groupe = $centre_groupe;
return $this;
}
public function getCentreType(): ?CentreType
{
return $this->centre_type;
}
public function setCentreType(?CentreType $centre_type): self
{
$this->centre_type = $centre_type;
return $this;
}
public function getIdOld(): ?int
{
return $this->id_old;
}
public function setIdOld(?int $id_old): self
{
$this->id_old = $id_old;
return $this;
}
public function isCliHasProAccess(): ?bool
{
return $this->cli_has_pro_access;
}
public function isCliVl(): ?bool
{
return $this->cli_vl;
}
public function setCliVl(?bool $cli_vl): self
{
$this->cli_vl = $cli_vl;
return $this;
}
public function isCliPl(): ?bool
{
return $this->cli_pl;
}
public function setCliPl(?bool $cli_pl): self
{
$this->cli_pl = $cli_pl;
return $this;
}
public function isCliCl(): ?bool
{
return $this->cli_cl;
}
public function setCliCl(?bool $cli_cl): self
{
$this->cli_cl = $cli_cl;
return $this;
}
}