<?php
namespace App\Entity;
use DateTime;
use Doctrine\ORM\Mapping as ORM;
use App\Repository\ProspectRepository;
use Doctrine\Common\Collections\Criteria;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use phpDocumentor\Reflection\Types\Array_;
use Symfony\Component\Security\Core\Security;
use App\Entity\Typologie;
use App\Entity\SecteurGeographique;
use App\Entity\Etage;
use App\Entity\VilleProgramme;
/**
* @ORM\Entity(repositoryClass=ProspectRepository::class)
*/
class Prospect
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="datetime")
*/
private $dateheure;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $dateDerniereModification;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $apporteur;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $societe;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurNom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurPrenom;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $emprunteurDateNaissance;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurAdresse;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurTelFr;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurTelCh;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurEmail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $emprunteurLieuTravail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurNom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurPrenom;
/**
* @ORM\Column(type="date", nullable=true)
*/
private $coEmprunteurDateNaissance;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurAdresse;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurTelFr;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurTelCh;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurEmail;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $coEmprunteurLieuTravail;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isRP;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isLocatif;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isTerrain;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isConstruction;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $isLMNP;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $budgetApproximatif;
/**
* @ORM\Column(type="float", nullable=true)
*/
private $mensualiteSouhaitee;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionProjetGlobal;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $rdvDateHeure1;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $rdvDateHeure2;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $rdvDateheure3;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $rdvDateHeure4;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $rdvDateHeure5;
/**
* @ORM\Column(type="datetime", nullable=true)
*/
private $rdvDateHeure6;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionDenonciations;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionSecteur;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionCriteresParticuliers;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionCriteresGeneraux;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionSituationActuelle;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $descriptionProgrammesProposes;
/**
* @ORM\OneToMany(targetEntity=Demande::class, mappedBy="auteur")
*/
private $demandes;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $emprunteurVille;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $emprunteurCodePostal;
/**
* @ORM\OneToMany(targetEntity=Proposition::class, mappedBy="prospect", orphanRemoval=true, cascade={"persist"})
* @ORM\OrderBy({"dateheure" = "DESC"})
*/
private $propositions;
/**
* @ORM\Column(type="string", length=128, nullable=true)
*/
private $coemprunteurVille;
/**
* @ORM\Column(type="string", length=32, nullable=true)
*/
private $coemprunteurCodePostal;
/**
* @ORM\Column(type="string", length=64, unique=true)
*/
private $token;
/**
* @ORM\OneToMany(targetEntity=Impression::class, mappedBy="prospect")
*/
private $impressions;
/**
* @ORM\OneToMany(targetEntity=Historique::class, mappedBy="prospect")
*/
private $historiques;
/**
* @ORM\Column(type="array", nullable=true)
*/
private $type = [];
/**
* @ORM\OneToMany(targetEntity=Denonciation::class, mappedBy="prospect", orphanRemoval=true, cascade={"persist"})
*/
private $denonciations;
/**
* @ORM\Column(type="string", length=24, nullable=true)
*/
private $statut;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $afficherNomCoEmprunteur;
/**
* @ORM\Column(type="boolean", nullable=true)
*/
private $afficherNomEmprunteur;
/**
* @ORM\ManyToOne(targetEntity=Utilisateur::class, inversedBy="prospects")
*/
private $auteur;
/**
* @ORM\ManyToOne(targetEntity=Entreprise::class, inversedBy="utilisateurs")
*/
private $entreprise;
/**
* @ORM\ManyToMany(targetEntity=InfosSuivi::class, mappedBy="prospects")
*/
private $infosSuivis;
/**
* @ORM\OneToMany(targetEntity=ActionTrace::class, mappedBy="prospect")
*/
private $actionTraces;
/**
* @ORM\ManyToMany(targetEntity=Typologie::class, inversedBy="prospects")
* @ORM\JoinTable(name="prospect_typologie")
*/
private $typologies;
/**
* @ORM\ManyToMany(targetEntity=SecteurGeographique::class, inversedBy="prospects")
* @ORM\JoinTable(name="prospect_secteur_geographique")
*/
private $secteursGeographiques;
/**
* @ORM\ManyToMany(targetEntity=Etage::class, inversedBy="prospects")
* @ORM\JoinTable(name="prospect_etage")
*/
private $etages;
/**
* @ORM\ManyToMany(targetEntity=VilleProgramme::class, inversedBy="prospects")
* @ORM\JoinTable(name="prospect_ville_programme")
*/
private $villesProgrammes;
public function __toString() {
return ($this->getId() == null ? 'Nouvelle fiche' : trim($this->getEmprunteurNom().' '.$this->getEmprunteurPrenom()));
}
public function __construct() {
$this->dateheure = new \DateTime("now");
$this->demandes = new ArrayCollection();
$this->propositions = new ArrayCollection();
$this->token = $this->generateUid(6);
$this->impressions = new ArrayCollection();
$this->historiques = new ArrayCollection();
$this->denonciations = new ArrayCollection();
$this->infosSuivis = new ArrayCollection();
$this->actionTraces = new ArrayCollection();
$this->typologies = new ArrayCollection();
$this->secteursGeographiques = new ArrayCollection();
$this->etages = new ArrayCollection();
$this->villesProgrammes = new ArrayCollection();
}
public function generateUid($l=10){
return substr(str_shuffle("0123456789abcdefghijklmnopqrstuvwxyz"), 0, $l);
}
public function lotIsProposed($lotId) {
$contains = false;
foreach($this->getPropositions() as $p) {
if($p->getLot()->getId() == $lotId) $contains = true;
}
return $contains;
}
public function getId(): ?int
{
return $this->id;
}
public function getDateheure(): ?\DateTimeInterface
{
return $this->dateheure;
}
public function setDateheure(\DateTimeInterface $dateheure): self
{
$this->dateheure = $dateheure;
return $this;
}
public function getDateDerniereModification(): ?\DateTimeInterface
{
return $this->dateDerniereModification;
}
public function setDateDerniereModification(\DateTimeInterface $dateDerniereModification): self
{
$this->dateDerniereModification = $dateDerniereModification;
return $this;
}
public function getApporteur(): ?string
{
return strtoupper($this->apporteur);
}
public function setApporteur(?string $apporteur): self
{
$this->apporteur = $apporteur;
return $this;
}
public function getSociete(): ?string
{
return $this->societe;
}
public function setSociete(?string $societe): self
{
$this->societe = $societe;
return $this;
}
public function getEmprunteurNom(): ?string
{
return strtoupper($this->emprunteurNom);
}
public function setEmprunteurNom(?string $emprunteurNom): self
{
$this->emprunteurNom = $emprunteurNom;
return $this;
}
public function getEmprunteurPrenom(): ?string
{
return strtoupper($this->emprunteurPrenom);
}
public function setEmprunteurPrenom(?string $emprunteurPrenom): self
{
$this->emprunteurPrenom = $emprunteurPrenom;
return $this;
}
public function getEmprunteurDateNaissance(): ?\DateTimeInterface
{
return $this->emprunteurDateNaissance;
}
public function setEmprunteurDateNaissance(?\DateTimeInterface $emprunteurDateNaissance): self
{
$this->emprunteurDateNaissance = $emprunteurDateNaissance;
return $this;
}
public function getEmprunteurAdresse(): ?string
{
return $this->emprunteurAdresse;
}
public function setEmprunteurAdresse(?string $emprunteurAdresse): self
{
$this->emprunteurAdresse = $emprunteurAdresse;
return $this;
}
public function getEmprunteurTelFr(): ?string
{
return $this->emprunteurTelFr;
}
public function setEmprunteurTelFr(?string $emprunteurTelFr): self
{
$this->emprunteurTelFr = $emprunteurTelFr;
return $this;
}
public function getEmprunteurTelCh(): ?string
{
return $this->emprunteurTelCh;
}
public function setEmprunteurTelCh(?string $emprunteurTelCh): self
{
$this->emprunteurTelCh = $emprunteurTelCh;
return $this;
}
public function getEmprunteurEmail(): ?string
{
return strtolower($this->emprunteurEmail);
}
public function setEmprunteurEmail(?string $emprunteurEmail): self
{
$this->emprunteurEmail = $emprunteurEmail;
return $this;
}
public function getEmprunteurLieuTravail(): ?string
{
return $this->emprunteurLieuTravail;
}
public function setEmprunteurLieuTravail(?string $emprunteurLieuTravail): self
{
$this->emprunteurLieuTravail = $emprunteurLieuTravail;
return $this;
}
public function getCoEmprunteurNom(): ?string
{
return $this->coEmprunteurNom;
}
public function setCoEmprunteurNom(?string $coEmprunteurNom): self
{
$this->coEmprunteurNom = $coEmprunteurNom;
return $this;
}
public function getCoEmprunteurPrenom(): ?string
{
return $this->coEmprunteurPrenom;
}
public function setCoEmprunteurPrenom(?string $coEmprunteurPrenom): self
{
$this->coEmprunteurPrenom = $coEmprunteurPrenom;
return $this;
}
public function getCoEmprunteurDateNaissance(): ?\DateTimeInterface
{
return $this->coEmprunteurDateNaissance;
}
public function setCoEmprunteurDateNaissance(?\DateTimeInterface $coEmprunteurDateNaissance): self
{
$this->coEmprunteurDateNaissance = $coEmprunteurDateNaissance;
return $this;
}
public function getCoEmprunteurAdresse(): ?string
{
return $this->coEmprunteurAdresse;
}
public function setCoEmprunteurAdresse(?string $coEmprunteurAdresse): self
{
$this->coEmprunteurAdresse = $coEmprunteurAdresse;
return $this;
}
public function getCoEmprunteurTelFr(): ?string
{
return $this->coEmprunteurTelFr;
}
public function setCoEmprunteurTelFr(?string $coEmprunteurTelFr): self
{
$this->coEmprunteurTelFr = $coEmprunteurTelFr;
return $this;
}
public function getCoEmprunteurTelCh(): ?string
{
return $this->coEmprunteurTelCh;
}
public function setCoEmprunteurTelCh(?string $coEmprunteurTelCh): self
{
$this->coEmprunteurTelCh = $coEmprunteurTelCh;
return $this;
}
public function getCoEmprunteurEmail(): ?string
{
return $this->coEmprunteurEmail;
}
public function setCoEmprunteurEmail(?string $coEmprunteurEmail): self
{
$this->coEmprunteurEmail = $coEmprunteurEmail;
return $this;
}
public function getCoEmprunteurLieuTravail(): ?string
{
return $this->coEmprunteurLieuTravail;
}
public function setCoEmprunteurLieuTravail(?string $coEmprunteurLieuTravail): self
{
$this->coEmprunteurLieuTravail = $coEmprunteurLieuTravail;
return $this;
}
public function getIsRP(): ?bool
{
return $this->isRP;
}
public function setIsRP(?bool $isRP): self
{
$this->isRP = $isRP;
return $this;
}
public function getIsLocatif(): ?bool
{
return $this->isLocatif;
}
public function setIsLocatif(?bool $isLocatif): self
{
$this->isLocatif = $isLocatif;
return $this;
}
public function getIsTerrain(): ?bool
{
return $this->isTerrain;
}
public function setIsTerrain(?bool $isTerrain): self
{
$this->isTerrain = $isTerrain;
return $this;
}
public function getIsConstruction(): ?bool
{
return $this->isConstruction;
}
public function setIsConstruction(?bool $isConstruction): self
{
$this->isConstruction = $isConstruction;
return $this;
}
public function getIsLMNP(): ?bool
{
return $this->isLMNP;
}
public function setIsLMNP(?bool $isLMNP): self
{
$this->isLMNP = $isLMNP;
return $this;
}
public function getBudgetApproximatif(): ?float
{
return $this->budgetApproximatif;
}
public function setBudgetApproximatif(?float $budgetApproximatif): self
{
$this->budgetApproximatif = $budgetApproximatif;
return $this;
}
public function getMensualiteSouhaitee(): ?float
{
return $this->mensualiteSouhaitee;
}
public function setMensualiteSouhaitee(?float $mensualiteSouhaitee): self
{
$this->mensualiteSouhaitee = $mensualiteSouhaitee;
return $this;
}
public function getDescriptionProjetGlobal(): ?string
{
return $this->descriptionProjetGlobal;
}
public function setDescriptionProjetGlobal(?string $descriptionProjetGlobal): self
{
$this->descriptionProjetGlobal = $descriptionProjetGlobal;
return $this;
}
public function getRdvDateHeure1(): ?\DateTimeInterface
{
return $this->rdvDateHeure1;
}
public function setRdvDateHeure1(?\DateTimeInterface $rdvDateHeure1): self
{
$this->rdvDateHeure1 = $rdvDateHeure1;
return $this;
}
public function getRdvDateHeure2(): ?\DateTimeInterface
{
return $this->rdvDateHeure2;
}
public function setRdvDateHeure2(?\DateTimeInterface $rdvDateHeure2): self
{
$this->rdvDateHeure2 = $rdvDateHeure2;
return $this;
}
public function getRdvDateheure3(): ?\DateTimeInterface
{
return $this->rdvDateheure3;
}
public function setRdvDateheure3(?\DateTimeInterface $rdvDateheure3): self
{
$this->rdvDateheure3 = $rdvDateheure3;
return $this;
}
public function getRdvDateHeure4(): ?\DateTimeInterface
{
return $this->rdvDateHeure4;
}
public function setRdvDateHeure4(?\DateTimeInterface $rdvDateHeure4): self
{
$this->rdvDateHeure4 = $rdvDateHeure4;
return $this;
}
public function getRdvDateHeure5(): ?\DateTimeInterface
{
return $this->rdvDateHeure5;
}
public function setRdvDateHeure5(?\DateTimeInterface $rdvDateHeure5): self
{
$this->rdvDateHeure5 = $rdvDateHeure5;
return $this;
}
public function getRdvDateHeure6(): ?\DateTimeInterface
{
return $this->rdvDateHeure6;
}
public function setRdvDateHeure6(?\DateTimeInterface $rdvDateHeure6): self
{
$this->rdvDateHeure6 = $rdvDateHeure6;
return $this;
}
public function getDescriptionDenonciations(): ?string
{
return $this->descriptionDenonciations;
}
public function setDescriptionDenonciations(?string $descriptionDenonciations): self
{
$this->descriptionDenonciations = $descriptionDenonciations;
return $this;
}
public function getDescriptionSecteur(): ?string
{
return $this->descriptionSecteur;
}
public function setDescriptionSecteur(?string $descriptionSecteur): self
{
$this->descriptionSecteur = $descriptionSecteur;
return $this;
}
public function getDescriptionCriteresParticuliers(): ?string
{
return $this->descriptionCriteresParticuliers;
}
public function setDescriptionCriteresParticuliers(?string $descriptionCriteresParticuliers): self
{
$this->descriptionCriteresParticuliers = $descriptionCriteresParticuliers;
return $this;
}
public function getDescriptionCriteresGeneraux(): ?string
{
return $this->descriptionCriteresGeneraux;
}
public function setDescriptionCriteresGeneraux(?string $descriptionCriteresGeneraux): self
{
$this->descriptionCriteresGeneraux = $descriptionCriteresGeneraux;
return $this;
}
public function getDescriptionSituationActuelle(): ?string
{
return $this->descriptionSituationActuelle;
}
public function setDescriptionSituationActuelle(?string $descriptionSituationActuelle): self
{
$this->descriptionSituationActuelle = $descriptionSituationActuelle;
return $this;
}
public function getDescriptionProgrammesProposes(): ?string
{
return $this->descriptionProgrammesProposes;
}
public function setDescriptionProgrammesProposes(?string $descriptionProgrammesProposes): self
{
$this->descriptionProgrammesProposes = $descriptionProgrammesProposes;
return $this;
}
/**
* @return Collection|Demande[]
*/
public function getDemandes(): Collection
{
return $this->demandes;
}
public function addDemande(Demande $demande): self
{
if (!$this->demandes->contains($demande)) {
$this->demandes[] = $demande;
$demande->setAuteur($this);
}
return $this;
}
public function removeDemande(Demande $demande): self
{
if ($this->demandes->removeElement($demande)) {
// set the owning side to null (unless already changed)
if ($demande->getAuteur() === $this) {
$demande->setAuteur(null);
}
}
return $this;
}
public function getEmprunteurVille(): ?string
{
return strtoupper($this->emprunteurVille);
}
public function setEmprunteurVille(?string $emprunteurVille): self
{
$this->emprunteurVille = $emprunteurVille;
return $this;
}
public function getEmprunteurCodePostal(): ?string
{
return strtoupper($this->emprunteurCodePostal);
}
public function setEmprunteurCodePostal(?string $emprunteurCodePostal): self
{
$this->emprunteurCodePostal = $emprunteurCodePostal;
return $this;
}
/**
* @return Collection|Proposition[]
*/
public function getPropositions(): Collection
{
return $this->propositions;
}
public function addProposition(Proposition $proposition): self
{
if (!$this->propositions->contains($proposition)) {
$this->propositions[] = $proposition;
$proposition->setProspect($this);
}
return $this;
}
public function getPropositionsReverse()
{
$sort = new Criteria(null, ['dateheure' => Criteria::DESC]);
return $this->propositions->matching($sort);
}
public function removeProposition(Proposition $proposition): self
{
if ($this->propositions->removeElement($proposition)) {
// set the owning side to null (unless already changed)
if ($proposition->getProspect() === $this) {
$proposition->setProspect(null);
}
}
return $this;
}
/**
* @return Collection|Proposition[]
*/
public function getActivePropositions(): Collection
{
return $this->propositions->filter(function(Proposition $proposition) {
return $proposition->isActiveProposition();
});
}
public function getCoemprunteurVille(): ?string
{
return $this->coemprunteurVille;
}
public function setCoemprunteurVille(?string $coemprunteurVille): self
{
$this->coemprunteurVille = $coemprunteurVille;
return $this;
}
public function getCoemprunteurCodePostal(): ?string
{
return $this->coemprunteurCodePostal;
}
public function setCoemprunteurCodePostal(?string $coemprunteurCodePostal): self
{
$this->coemprunteurCodePostal = $coemprunteurCodePostal;
return $this;
}
public function getToken(): ?string
{
return $this->token;
}
public function setToken(string $token): self
{
$this->token = $token;
return $this;
}
/**
* @return Collection|Impression[]
*/
public function getImpressions(): Collection
{
return $this->impressions;
}
public function addImpression(Impression $impression): self
{
if (!$this->impressions->contains($impression)) {
$this->impressions[] = $impression;
$impression->setProspect($this);
}
return $this;
}
public function removeImpression(Impression $impression): self
{
if ($this->impressions->removeElement($impression)) {
// set the owning side to null (unless already changed)
if ($impression->getProspect() === $this) {
$impression->setProspect(null);
}
}
return $this;
}
/**
* @return Collection|Historique[]
*/
public function getHistoriques(): Collection
{
return $this->historiques;
}
public function getHistoriquesUniqueExpediteur(): array
{
$uniqueExpediteursList = array();
foreach($this->historiques as $historique){
$expediteur = $historique->getExpediteur();
if(!in_array($expediteur, $uniqueExpediteursList)){
$uniqueExpediteursList[] = $expediteur;
}
}
return $uniqueExpediteursList;
}
public function addHistorique(Historique $historique): self
{
if (!$this->historiques->contains($historique)) {
$this->historiques[] = $historique;
$historique->setProspect($this);
}
return $this;
}
public function removeHistorique(Historique $historique): self
{
if ($this->historiques->removeElement($historique)) {
// set the owning side to null (unless already changed)
if ($historique->getProspect() === $this) {
$historique->setProspect(null);
}
}
return $this;
}
public function getType(): ?array
{
return $this->type;
}
public function setType(?array $type): self
{
$this->type = $type;
return $this;
}
/**
* @return Collection|Denonciation[]
*/
public function getDenonciations(): Collection
{
return $this->denonciations;
}
public function addDenonciation(Denonciation $denonciation): self
{
if (!$this->denonciations->contains($denonciation)) {
$this->denonciations[] = $denonciation;
$denonciation->setProspect($this);
}
return $this;
}
public function removeDenonciation(Denonciation $denonciation): self
{
if ($this->denonciations->removeElement($denonciation)) {
// set the owning side to null (unless already changed)
if ($denonciation->getProspect() === $this) {
$denonciation->setProspect(null);
}
}
return $this;
}
public function getStatut(): ?string
{
return $this->statut;
}
public function setStatut(?string $statut): self
{
$this->statut = $statut;
return $this;
}
public function isAfficherNomCoEmprunteur(): ?bool
{
return $this->afficherNomCoEmprunteur;
}
public function setAfficherNomCoEmprunteur(?bool $afficherNomCoEmprunteur): self
{
$this->afficherNomCoEmprunteur = $afficherNomCoEmprunteur;
return $this;
}
public function isAfficherNomEmprunteur(): ?bool
{
return $this->afficherNomEmprunteur;
}
public function setAfficherNomEmprunteur(?bool $afficherNomEmprunteur): self
{
$this->afficherNomEmprunteur = $afficherNomEmprunteur;
return $this;
}
public function getAuteur(): ?Utilisateur
{
return $this->auteur;
}
public function setAuteur(?Utilisateur $auteur): self
{
$this->auteur = $auteur;
return $this;
}
public function getEntreprise(): ?Entreprise
{
return $this->entreprise;
}
public function setEntreprise(?Entreprise $entreprise): self
{
$this->entreprise = $entreprise;
return $this;
}
/**
* @return Collection<int, InfosSuivi>
*/
public function getInfosSuivis(): Collection
{
return $this->infosSuivis;
}
public function addInfosSuivi(InfosSuivi $infosSuivi): self
{
if (!$this->infosSuivis->contains($infosSuivi)) {
$this->infosSuivis[] = $infosSuivi;
$infosSuivi->addProspect($this);
}
return $this;
}
public function removeInfosSuivi(InfosSuivi $infosSuivi): self
{
if ($this->infosSuivis->removeElement($infosSuivi)) {
$infosSuivi->removeProspect($this);
}
return $this;
}
/**
* @return Collection<int, ActionTrace>
*/
public function getActionTraces(): Collection
{
return $this->actionTraces;
}
public function addActionTrace(ActionTrace $actionTrace): self
{
if (!$this->actionTraces->contains($actionTrace)) {
$this->actionTraces[] = $actionTrace;
$actionTrace->setProspect($this);
}
return $this;
}
public function removeActionTrace(ActionTrace $actionTrace): self
{
if ($this->actionTraces->removeElement($actionTrace)) {
// set the owning side to null (unless already changed)
if ($actionTrace->getProspect() === $this) {
$actionTrace->setProspect(null);
}
}
return $this;
}
public function getActionsCommerciales(): string
{
if ($this->actionTraces->isEmpty()) {
return '';
}
$actions = [];
foreach ($this->actionTraces as $actionTrace) {
$date = $actionTrace->getCreatedAt() ? $actionTrace->getCreatedAt()->format('d/m/Y H:i') : '';
$user = $actionTrace->getUser() ? $actionTrace->getUser()->getNomEtPrenom() : '';
$type = $actionTrace->getType() ?: '';
$description = $actionTrace->getDescription() ? ' - ' . $actionTrace->getDescription() : '';
$actions[] = sprintf('[%s] %s par %s%s', $date, $type, $user, $description);
}
return implode(PHP_EOL, $actions);
}
public function getLastActionTrace(): string
{
if ($this->actionTraces->isEmpty()) {
return '';
}
$lastAction = $this->actionTraces->last();
$date = $lastAction->getCreatedAt() ? $lastAction->getCreatedAt()->format('d/m/Y H:i') : '';
$type = $lastAction->getType() ?: '';
return sprintf('[%s] %s', $date, $type);
}
/**
* Retourne le libellé lisible du statut
*/
public function getStatutLibelle(): ?string
{
$statuts = [
'atraiter' => 'À traiter',
'attentenouveaute' => 'À relancer',
'encourstraitement' => 'En cours de traitement',
'reservation' => 'Réservation',
'adejatrouve' => 'À externaliser',
'archive' => 'Archivé',
null => 'Non classé'
];
return $statuts[$this->statut] ?? 'Non classé';
}
/**
* @return Collection<int, Typologie>
*/
public function getTypologies(): Collection
{
return $this->typologies;
}
public function addTypologie(Typologie $typologie): self
{
if (!$this->typologies->contains($typologie)) {
$this->typologies[] = $typologie;
}
return $this;
}
public function removeTypologie(Typologie $typologie): self
{
$this->typologies->removeElement($typologie);
return $this;
}
/**
* @return Collection<int, SecteurGeographique>
*/
public function getSecteursGeographiques(): Collection
{
return $this->secteursGeographiques;
}
public function addSecteurGeographique(SecteurGeographique $secteurGeographique): self
{
if (!$this->secteursGeographiques->contains($secteurGeographique)) {
$this->secteursGeographiques[] = $secteurGeographique;
}
return $this;
}
public function removeSecteurGeographique(SecteurGeographique $secteurGeographique): self
{
$this->secteursGeographiques->removeElement($secteurGeographique);
return $this;
}
/**
* @return Collection<int, Etage>
*/
public function getEtages(): Collection
{
return $this->etages;
}
public function addEtage(Etage $etage): self
{
if (!$this->etages->contains($etage)) {
$this->etages[] = $etage;
}
return $this;
}
public function removeEtage(Etage $etage): self
{
$this->etages->removeElement($etage);
return $this;
}
/**
* @return Collection<int, VilleProgramme>
*/
public function getVillesProgrammes(): Collection
{
return $this->villesProgrammes;
}
public function addVilleProgramme(VilleProgramme $villeProgramme): self
{
if (!$this->villesProgrammes->contains($villeProgramme)) {
$this->villesProgrammes[] = $villeProgramme;
}
return $this;
}
public function removeVilleProgramme(VilleProgramme $villeProgramme): self
{
$this->villesProgrammes->removeElement($villeProgramme);
return $this;
}
public function getTypologie(): ?Typologie
{
return $this->typologies->first() ?: null;
}
public function setTypologie(?Typologie $typologie): self
{
$this->typologies->clear();
if ($typologie) {
$this->addTypologie($typologie);
}
return $this;
}
public function getSecteurGeographique(): ?SecteurGeographique
{
return $this->secteursGeographiques->first() ?: null;
}
public function setSecteurGeographique(?SecteurGeographique $secteurGeographique): self
{
$this->secteursGeographiques->clear();
if ($secteurGeographique) {
$this->addSecteurGeographique($secteurGeographique);
}
return $this;
}
public function getEtage(): ?Etage
{
return $this->etages->first() ?: null;
}
public function setEtage(?Etage $etage): self
{
$this->etages->clear();
if ($etage) {
$this->addEtage($etage);
}
return $this;
}
public function getVilleProgramme(): ?VilleProgramme
{
return $this->villesProgrammes->first() ?: null;
}
public function setVilleProgramme(?VilleProgramme $villeProgramme): self
{
$this->villesProgrammes->clear();
if ($villeProgramme) {
$this->addVilleProgramme($villeProgramme);
}
return $this;
}
/**
* Retourne les typologies sous forme de chaîne pour l'export
*/
public function getTypologiesAsString(): string
{
if ($this->typologies->isEmpty()) {
return '';
}
$names = [];
foreach ($this->typologies as $typologie) {
$names[] = $typologie->getNom();
}
return implode(', ', $names);
}
/**
* Retourne les secteurs géographiques sous forme de chaîne pour l'export
*/
public function getSecteursGeographiquesAsString(): string
{
if ($this->secteursGeographiques->isEmpty()) {
return '';
}
$names = [];
foreach ($this->secteursGeographiques as $secteur) {
$names[] = $secteur->getNom();
}
return implode(', ', $names);
}
/**
* Retourne les étages sous forme de chaîne pour l'export
*/
public function getEtagesAsString(): string
{
if ($this->etages->isEmpty()) {
return '';
}
$names = [];
foreach ($this->etages as $etage) {
$names[] = $etage->getNom();
}
return implode(', ', $names);
}
/**
* Retourne les villes/programmes sous forme de chaîne pour l'export
*/
public function getVillesProgrammesAsString(): string
{
if ($this->villesProgrammes->isEmpty()) {
return '';
}
$names = [];
foreach ($this->villesProgrammes as $ville) {
$names[] = $ville->getNom();
}
return implode(', ', $names);
}
}