<?php
namespace App\Entity;
use App\Repository\AcheteurRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Doctrine\ORM\Mapping\OneToMany;
#[ORM\Entity(repositoryClass: AcheteurRepository::class)]
class Acheteur
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne]
private ?Events $event = null;
#[ORM\Column(length: 50)]
private ?string $nom = null;
#[ORM\Column(length: 50)]
private ?string $prenom = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $note = null;
#[ORM\ManyToOne]
private ?Couleur $couleur = null;
#[ORM\ManyToOne]
private ?ModePaiement $modePaiement = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $gererPar = null;
#[ORM\ManyToOne]
private ?Qualite $qualite = null;
#[ORM\ManyToOne]
private ?Broker $broker = null;
#[ORM\ManyToOne]
private ?Paiement $paiement = null;
#[ORM\ManyToOne]
private ?TypePrepaye $paiementPrepaye = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $addresse = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $cp = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $ville = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $pays = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $dob = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $login = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $password = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mail_sec = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $old_mail = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $old_mail_sec = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mail = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tel = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $note_tel = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $secret = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tel_securite = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $tel_securite_sec = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mail_securite = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mail_securite_sec = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mail_transfert = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mail_transfert_sec = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $note_login = null;
#[OneToMany(mappedBy: 'acheteur', targetEntity: SerieBillet::class, cascade: ['persist', 'remove'], orphanRemoval: true)]
private Collection $serieBillets;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2015 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2015 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2016 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2016 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2017 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2017 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2018 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2018 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2019 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2019 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2020 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2020 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2021 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2021 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2022 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2022 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2023 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2023 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $download2322 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $downloadNote2322 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $diretctedBy2322 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $download2323 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $downloadNote2323 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $diretctedBy2323 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $noteCb = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIp2024 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $commandIpNote2024 = null;
#[ORM\OneToMany(mappedBy: 'acheteur', targetEntity: CommandeIpAcheteur::class, orphanRemoval: true)]
private Collection $commandeIpAcheteurs;
public function __construct()
{
$this->serieBillets = new ArrayCollection();
$this->commandeIpAcheteurs = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEvent(): ?Events
{
return $this->event;
}
public function setEvent(?Events $event): self
{
$this->event = $event;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getPrenom(): ?string
{
return $this->prenom;
}
public function setPrenom(string $prenom): self
{
$this->prenom = $prenom;
return $this;
}
public function getNote(): ?string
{
return $this->note;
}
public function setNote(?string $note): self
{
$this->note = $note;
return $this;
}
public function getCouleur(): ?Couleur
{
return $this->couleur;
}
public function setCouleur(?Couleur $couleur): self
{
$this->couleur = $couleur;
return $this;
}
public function getModePaiement(): ?ModePaiement
{
return $this->modePaiement;
}
public function setModePaiement(?ModePaiement $modePaiement): self
{
$this->modePaiement = $modePaiement;
return $this;
}
public function getGererPar(): ?string
{
return $this->gererPar;
}
public function setGererPar(?string $gererPar): self
{
$this->gererPar = $gererPar;
return $this;
}
public function getQualite(): ?Qualite
{
return $this->qualite;
}
public function setQualite(?Qualite $qualite): self
{
$this->qualite = $qualite;
return $this;
}
public function getBroker(): ?Broker
{
return $this->broker;
}
public function setBroker(?Broker $broker): self
{
$this->broker = $broker;
return $this;
}
public function getPaiement(): ?Paiement
{
return $this->paiement;
}
public function setPaiement(?Paiement $paiement): self
{
$this->paiement = $paiement;
return $this;
}
public function getPaiementPrepaye(): ?TypePrepaye
{
return $this->paiementPrepaye;
}
public function setPaiementPrepaye(?TypePrepaye $paiementPrepaye): self
{
$this->paiementPrepaye = $paiementPrepaye;
return $this;
}
public function getAddresse(): ?string
{
return $this->addresse;
}
public function setAddresse(?string $addresse): self
{
$this->addresse = $addresse;
return $this;
}
public function getCp(): ?string
{
return $this->cp;
}
public function setCp(?string $cp): self
{
$this->cp = $cp;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getPays(): ?string
{
return $this->pays;
}
public function setPays(?string $pays): self
{
$this->pays = $pays;
return $this;
}
public function getDob(): ?\DateTimeInterface
{
return $this->dob;
}
public function setDob(?\DateTimeInterface $dob): self
{
$this->dob = $dob;
return $this;
}
public function getLogin(): ?string
{
return $this->login;
}
public function setLogin(?string $login): self
{
$this->login = $login;
return $this;
}
public function getPassword(): ?string
{
return $this->password;
}
public function setPassword(?string $password): self
{
$this->password = $password;
return $this;
}
public function getMailSec(): ?string
{
return $this->mail_sec;
}
public function setMailSec(?string $mail_sec): self
{
$this->mail_sec = $mail_sec;
return $this;
}
public function getOldMail(): ?string
{
return $this->old_mail;
}
public function setOldMail(?string $old_mail): self
{
$this->old_mail = $old_mail;
return $this;
}
public function getOldMailSec(): ?string
{
return $this->old_mail_sec;
}
public function setOldMailSec(?string $old_mail_sec): self
{
$this->old_mail_sec = $old_mail_sec;
return $this;
}
public function getMail(): ?string
{
return $this->mail;
}
public function setMail(?string $mail): self
{
$this->mail = $mail;
return $this;
}
public function getTel(): ?string
{
return $this->tel;
}
public function setTel(?string $tel): self
{
$this->tel = $tel;
return $this;
}
public function getNoteTel(): ?string
{
return $this->note_tel;
}
public function setNoteTel(?string $note_tel): self
{
$this->note_tel = $note_tel;
return $this;
}
public function getSecret(): ?string
{
return $this->secret;
}
public function setSecret(?string $secret): self
{
$this->secret = $secret;
return $this;
}
public function getTelSecurite(): ?string
{
return $this->tel_securite;
}
public function setTelSecurite(?string $tel_securite): self
{
$this->tel_securite = $tel_securite;
return $this;
}
public function getTelSecuriteSec(): ?string
{
return $this->tel_securite_sec;
}
public function setTelSecuriteSec(?string $tel_securite_sec): self
{
$this->tel_securite_sec = $tel_securite_sec;
return $this;
}
public function getMailSecurite(): ?string
{
return $this->mail_securite;
}
public function setMailSecurite(?string $mail_securite): self
{
$this->mail_securite = $mail_securite;
return $this;
}
public function getMailSecuriteSec(): ?string
{
return $this->mail_securite_sec;
}
public function setMailSecuriteSec(?string $mail_securite_sec): self
{
$this->mail_securite_sec = $mail_securite_sec;
return $this;
}
public function getMailTransfert(): ?string
{
return $this->mail_transfert;
}
public function setMailTransfert(?string $mail_transfert): self
{
$this->mail_transfert = $mail_transfert;
return $this;
}
public function getMailTransfertSec(): ?string
{
return $this->mail_transfert_sec;
}
public function setMailTransfertSec(?string $mail_transfert_sec): self
{
$this->mail_transfert_sec = $mail_transfert_sec;
return $this;
}
public function getNoteLogin(): ?string
{
return $this->note_login;
}
public function setNoteLogin(?string $note_login): self
{
$this->note_login = $note_login;
return $this;
}
/**
* @return Collection<int, SerieBillet>
*/
public function getSerieBillets(): array
{
$currentEventId = null;
if (isset($_COOKIE['current_event_id'])) {
$currentEventId = $_COOKIE['current_event_id'];
}
$serieBillets = [];
foreach ($this->serieBillets as $serieBillet) {
if($serieBillet->getSession()->getEvent()->getId() == $currentEventId) {
$serieBillets[] = $serieBillet;
}
}
return $serieBillets;
}
public function addSerieBillet(SerieBillet $serieBillet): self
{
if (!$this->serieBillets->contains($serieBillet)) {
$this->serieBillets->add($serieBillet);
$serieBillet->setAcheteur($this);
}
return $this;
}
public function removeSerieBillet(SerieBillet $serieBillet): self
{
/** @var Billet $billet */
foreach ($serieBillet->getBillets() as $billet) {
$billet->setSerieBillet(null);
$billet->setAcheteur(null);
}
if ($this->serieBillets->removeElement($serieBillet)) {
// set the owning side to null (unless already changed)
if ($serieBillet->getAcheteur() === $this) {
$serieBillet->setAcheteur(null);
}
}
return $this;
}
public function getCommandIp(): ?string
{
return $this->commandIp;
}
public function setCommandIp(?string $commandIp): self
{
$this->commandIp = $commandIp;
return $this;
}
public function getCommandIpNote(): ?string
{
return $this->commandIpNote;
}
public function setCommandIpNote(?string $commandIpNote): self
{
$this->commandIpNote = $commandIpNote;
return $this;
}
public function getCommandIp2015(): ?string
{
return $this->commandIp2015;
}
public function setCommandIp2015(?string $commandIp2015): self
{
$this->commandIp2015 = $commandIp2015;
return $this;
}
public function getCommandIpNote2015(): ?string
{
return $this->commandIpNote2015;
}
public function setCommandIpNote2015(?string $commandIpNote2015): self
{
$this->commandIpNote2015 = $commandIpNote2015;
return $this;
}
public function getCommandIp2016(): ?string
{
return $this->commandIp2016;
}
public function setCommandIp2016(?string $commandIp2016): self
{
$this->commandIp2016 = $commandIp2016;
return $this;
}
public function getCommandIpNote2016(): ?string
{
return $this->commandIpNote2016;
}
public function setCommandIpNote2016(?string $commandIpNote2016): self
{
$this->commandIpNote2016 = $commandIpNote2016;
return $this;
}
public function getCommandIp2017(): ?string
{
return $this->commandIp2017;
}
public function setCommandIp2017(?string $commandIp2017): self
{
$this->commandIp2017 = $commandIp2017;
return $this;
}
public function getCommandIpNote2017(): ?string
{
return $this->commandIpNote2017;
}
public function setCommandIpNote2017(?string $commandIpNote2017): self
{
$this->commandIpNote2017 = $commandIpNote2017;
return $this;
}
public function getCommandIp2018(): ?string
{
return $this->commandIp2018;
}
public function setCommandIp2018(?string $commandIp2018): self
{
$this->commandIp2018 = $commandIp2018;
return $this;
}
public function getCommandIpNote2018(): ?string
{
return $this->commandIpNote2018;
}
public function setCommandIpNote2018(?string $commandIpNote2018): self
{
$this->commandIpNote2018 = $commandIpNote2018;
return $this;
}
public function getCommandIp2019(): ?string
{
return $this->commandIp2019;
}
public function setCommandIp2019(?string $commandIp2019): self
{
$this->commandIp2019 = $commandIp2019;
return $this;
}
public function getCommandIpNote2019(): ?string
{
return $this->commandIpNote2019;
}
public function setCommandIpNote2019(?string $commandIpNote2019): self
{
$this->commandIpNote2019 = $commandIpNote2019;
return $this;
}
public function getCommandIp2020(): ?string
{
return $this->commandIp2020;
}
public function setCommandIp2020(?string $commandIp2020): self
{
$this->commandIp2020 = $commandIp2020;
return $this;
}
public function getCommandIpNote2020(): ?string
{
return $this->commandIpNote2020;
}
public function setCommandIpNote2020(?string $commandIpNote2020): self
{
$this->commandIpNote2020 = $commandIpNote2020;
return $this;
}
public function getCommandIp2021(): ?string
{
return $this->commandIp2021;
}
public function setCommandIp2021(?string $commandIp2021): self
{
$this->commandIp2021 = $commandIp2021;
return $this;
}
public function getCommandIpNote2021(): ?string
{
return $this->commandIpNote2021;
}
public function setCommandIpNote2021(string $commandIpNote2021): self
{
$this->commandIpNote2021 = $commandIpNote2021;
return $this;
}
public function getCommandIp2022(): ?string
{
return $this->commandIp2022;
}
public function setCommandIp2022(?string $commandIp2022): self
{
$this->commandIp2022 = $commandIp2022;
return $this;
}
public function getCommandIpNote2022(): ?string
{
return $this->commandIpNote2022;
}
public function setCommandIpNote2022(?string $commandIpNote2022): self
{
$this->commandIpNote2022 = $commandIpNote2022;
return $this;
}
public function getCommandIp2023(): ?string
{
return $this->commandIp2023;
}
public function setCommandIp2023(?string $commandIp2023): self
{
$this->commandIp2023 = $commandIp2023;
return $this;
}
public function getCommandIpNote2023(): ?string
{
return $this->commandIpNote2023;
}
public function setCommandIpNote2023(?string $commandIpNote2023): self
{
$this->commandIpNote2023 = $commandIpNote2023;
return $this;
}
public function getDownload2322(): ?string
{
return $this->download2322;
}
public function setDownload2322(?string $download2322): self
{
$this->download2322 = $download2322;
return $this;
}
public function getDownloadNote2322(): ?string
{
return $this->downloadNote2322;
}
public function setDownloadNote2322(?string $downloadNote2322): self
{
$this->downloadNote2322 = $downloadNote2322;
return $this;
}
public function getDiretctedBy2322(): ?string
{
return $this->diretctedBy2322;
}
public function setDiretctedBy2322(?string $diretctedBy2322): self
{
$this->diretctedBy2322 = $diretctedBy2322;
return $this;
}
public function getDownload2323(): ?string
{
return $this->download2323;
}
public function setDownload2323(?string $download2323): self
{
$this->download2323 = $download2323;
return $this;
}
public function getDownloadNote2323(): ?string
{
return $this->downloadNote2323;
}
public function setDownloadNote2323(?string $downloadNote2323): self
{
$this->downloadNote2323 = $downloadNote2323;
return $this;
}
public function getDiretctedBy2323(): ?string
{
return $this->diretctedBy2323;
}
public function setDiretctedBy2323(?string $diretctedBy2323): self
{
$this->diretctedBy2323 = $diretctedBy2323;
return $this;
}
public function getNoteCb(): ?string
{
return $this->noteCb;
}
public function setNoteCb(?string $noteCb): self
{
$this->noteCb = $noteCb;
return $this;
}
public function __toString()
{
return $this->getNom().' '.$this->getPrenom();
}
/**
* @return string|null
*/
public function getColorCode(): ?string
{
// Vérifiez si l'entité COLOR est associée à l'acheteur
if (null === $this->couleur) {
return null;
}
// Récupérez le code couleur de l'entité COLOR associée
return $this->couleur->getCode();
}
public function getTotalCommandes(?int $eventId = null): float
{
$total = 0;
/** @var SerieBillet $serieBillet */
foreach ($this->getSerieBillets() as $serieBillet) {
if(!$serieBillet->isActive())
$total += ($serieBillet->getTarif()*$serieBillet->getNbr()) + $serieBillet->getCommision();
}
return $total;
}
public function getTotalSerieBillet(?int $eventId = null): int
{
$total = 0;
/** @var SerieBillet $serieBillet */
foreach ($this->getSerieBillets() as $serieBillet) {
if(!$serieBillet->isActive())
$total ++;
}
return $total;
}
public function getTotalBillet(?int $eventId = null): int
{
$total = 0;
/** @var SerieBillet $serieBillet */
foreach ($this->getSerieBillets() as $serieBillet) {
if(!$serieBillet->isActive())
$total += $serieBillet->getNbr();
}
return $total;
}
public function getFullName(): string
{
return $this->getPrenom().' '.$this->getNom();
}
public function __clone(): void
{
if ($this->id) {
$this->id = null;
$this->event = null;
$this->serieBillets = new ArrayCollection();
}
}
public function getCommandIp2024(): ?string
{
return $this->commandIp2024;
}
public function setCommandIp2024(?string $commandIp2024): static
{
$this->commandIp2024 = $commandIp2024;
return $this;
}
public function getCommandIpNote2024(): ?string
{
return $this->commandIpNote2024;
}
public function setCommandIpNote2024(?string $commandIpNote2024): static
{
$this->commandIpNote2024 = $commandIpNote2024;
return $this;
}
/**
* @return Collection<int, CommandeIpAcheteur>
*/
public function getCommandeIpAcheteurs(): Collection
{
return $this->commandeIpAcheteurs;
}
public function addCommandeIpAcheteur(CommandeIpAcheteur $commandeIpAcheteur): static
{
if (!$this->commandeIpAcheteurs->contains($commandeIpAcheteur)) {
$this->commandeIpAcheteurs->add($commandeIpAcheteur);
$commandeIpAcheteur->setAcheteur($this);
}
return $this;
}
public function removeCommandeIpAcheteur(CommandeIpAcheteur $commandeIpAcheteur): static
{
if ($this->commandeIpAcheteurs->removeElement($commandeIpAcheteur)) {
// set the owning side to null (unless already changed)
if ($commandeIpAcheteur->getAcheteur() === $this) {
$commandeIpAcheteur->setAcheteur(null);
}
}
return $this;
}
}