<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
*/
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
private $email;
/**
* @ORM\Column(type="json")
*/
private $roles = [];
/**
* @var string The hashed password
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Civilite;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Nom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Prenom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $RaisonSociale;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $Siret;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Tva;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Adresse;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $CodePostal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Telephone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Logo;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $Type;
/**
* @ORM\OneToMany(targetEntity=Favoris::class, mappedBy="User")
*/
private $favoris;
/**
* @ORM\OneToMany(targetEntity=Annonces::class, mappedBy="User")
*/
private $annonces;
/**
* @ORM\OneToMany(targetEntity=NotesEnseignes::class, mappedBy="User")
*/
private $notesEnseignes;
/**
* @ORM\OneToMany(targetEntity=NotesAnnonces::class, mappedBy="User")
*/
private $notesAnnonces;
/**
* @ORM\OneToMany(targetEntity=Alertes::class, mappedBy="User")
*/
private $alertes;
/**
* @ORM\Column(type="boolean")
*/
private $Actif = 1;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $Credits = 100;
/**
* @ORM\ManyToOne(targetEntity=Villes::class, inversedBy="users")
*/
private $Villes;
/**
* @ORM\ManyToOne(targetEntity=Pays::class, inversedBy="users")
*/
private $Pays;
/**
* @ORM\Column(type="datetime")
*/
private $Created;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $TokenMobile;
/**
* @ORM\OneToMany(targetEntity=Commandes::class, mappedBy="User")
*/
private $commandes;
/**
* @ORM\OneToMany(targetEntity=Factures::class, mappedBy="User")
*/
private $factures;
public function __construct()
{
$this->favoris = new ArrayCollection();
$this->annonces = new ArrayCollection();
$this->notesEnseignes = new ArrayCollection();
$this->notesAnnonces = new ArrayCollection();
$this->alertes = new ArrayCollection();
$this->commandes = new ArrayCollection();
$this->factures = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->email;
}
/**
* @deprecated since Symfony 5.3, use getUserIdentifier instead
*/
public function getUsername(): string
{
return (string) $this->email;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
$roles[] = 'ROLE_USER';
return array_unique($roles);
}
public function setRoles(array $roles): self
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): self
{
$this->password = $password;
return $this;
}
/**
* Returning a salt is only needed, if you are not using a modern
* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
*
* @see UserInterface
*/
public function getSalt(): ?string
{
return null;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getCivilite(): ?string
{
return $this->Civilite;
}
public function setCivilite(?string $Civilite): self
{
$this->Civilite = $Civilite;
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 getRaisonSociale(): ?string
{
return $this->RaisonSociale;
}
public function setRaisonSociale(?string $RaisonSociale): self
{
$this->RaisonSociale = $RaisonSociale;
return $this;
}
public function getSiret(): ?int
{
return $this->Siret;
}
public function setSiret(?int $Siret): self
{
$this->Siret = $Siret;
return $this;
}
public function getTva(): ?string
{
return $this->Tva;
}
public function setTva(?string $Tva): self
{
$this->Tva = $Tva;
return $this;
}
public function getAdresse(): ?string
{
return $this->Adresse;
}
public function setAdresse(?string $Adresse): self
{
$this->Adresse = $Adresse;
return $this;
}
public function getCodePostal(): ?string
{
return $this->CodePostal;
}
public function setCodePostal(?string $CodePostal): self
{
$this->CodePostal = $CodePostal;
return $this;
}
public function getTelephone(): ?string
{
return $this->Telephone;
}
public function setTelephone(?string $Telephone): self
{
$this->Telephone = $Telephone;
return $this;
}
public function getLogo(): ?string
{
return $this->Logo;
}
public function setLogo(?string $Logo): self
{
$this->Logo = $Logo;
return $this;
}
public function getType(): ?string
{
return $this->Type;
}
public function setType(?string $Type): self
{
$this->Type = $Type;
return $this;
}
/**
* @return Collection<int, Favoris>
*/
public function getFavoris(): Collection
{
return $this->favoris;
}
public function addFavori(Favoris $favori): self
{
if (!$this->favoris->contains($favori)) {
$this->favoris[] = $favori;
$favori->setUser($this);
}
return $this;
}
public function removeFavori(Favoris $favori): self
{
if ($this->favoris->removeElement($favori)) {
// set the owning side to null (unless already changed)
if ($favori->getUser() === $this) {
$favori->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Annonces>
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonces $annonce): self
{
if (!$this->annonces->contains($annonce)) {
$this->annonces[] = $annonce;
$annonce->setUser($this);
}
return $this;
}
public function removeAnnonce(Annonces $annonce): self
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getUser() === $this) {
$annonce->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, NotesEnseignes>
*/
public function getNotesEnseignes(): Collection
{
return $this->notesEnseignes;
}
public function addNotesEnseigne(NotesEnseignes $notesEnseigne): self
{
if (!$this->notesEnseignes->contains($notesEnseigne)) {
$this->notesEnseignes[] = $notesEnseigne;
$notesEnseigne->setUser($this);
}
return $this;
}
public function removeNotesEnseigne(NotesEnseignes $notesEnseigne): self
{
if ($this->notesEnseignes->removeElement($notesEnseigne)) {
// set the owning side to null (unless already changed)
if ($notesEnseigne->getUser() === $this) {
$notesEnseigne->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, NotesAnnonces>
*/
public function getNotesAnnonces(): Collection
{
return $this->notesAnnonces;
}
public function addNotesAnnonce(NotesAnnonces $notesAnnonce): self
{
if (!$this->notesAnnonces->contains($notesAnnonce)) {
$this->notesAnnonces[] = $notesAnnonce;
$notesAnnonce->setUser($this);
}
return $this;
}
public function removeNotesAnnonce(NotesAnnonces $notesAnnonce): self
{
if ($this->notesAnnonces->removeElement($notesAnnonce)) {
// set the owning side to null (unless already changed)
if ($notesAnnonce->getUser() === $this) {
$notesAnnonce->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Alertes>
*/
public function getAlertes(): Collection
{
return $this->alertes;
}
public function addAlerte(Alertes $alerte): self
{
if (!$this->alertes->contains($alerte)) {
$this->alertes[] = $alerte;
$alerte->setUser($this);
}
return $this;
}
public function removeAlerte(Alertes $alerte): self
{
if ($this->alertes->removeElement($alerte)) {
// set the owning side to null (unless already changed)
if ($alerte->getUser() === $this) {
$alerte->setUser(null);
}
}
return $this;
}
public function isActif(): ?bool
{
return $this->Actif;
}
public function setActif(bool $Actif): self
{
$this->Actif = $Actif;
return $this;
}
public function getCredits(): ?int
{
return $this->Credits;
}
public function setCredits(?int $Credits): self
{
$this->Credits = $Credits;
return $this;
}
public function getVilles(): ?Villes
{
return $this->Villes;
}
public function setVilles(?Villes $Villes): self
{
$this->Villes = $Villes;
return $this;
}
public function getPays(): ?Pays
{
return $this->Pays;
}
public function setPays(?Pays $Pays): self
{
$this->Pays = $Pays;
return $this;
}
public function getCreated(): ?\DateTimeInterface
{
return $this->Created;
}
public function setCreated(\DateTimeInterface $Created): self
{
$this->Created = $Created;
return $this;
}
public function getTokenMobile(): ?string
{
return $this->TokenMobile;
}
public function setTokenMobile(?string $TokenMobile): self
{
$this->TokenMobile = $TokenMobile;
return $this;
}
/**
* @return Collection<int, Commandes>
*/
public function getCommandes(): Collection
{
return $this->commandes;
}
public function addCommande(Commandes $commande): self
{
if (!$this->commandes->contains($commande)) {
$this->commandes[] = $commande;
$commande->setUser($this);
}
return $this;
}
public function removeCommande(Commandes $commande): self
{
if ($this->commandes->removeElement($commande)) {
// set the owning side to null (unless already changed)
if ($commande->getUser() === $this) {
$commande->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Factures>
*/
public function getFactures(): Collection
{
return $this->factures;
}
public function addFacture(Factures $facture): self
{
if (!$this->factures->contains($facture)) {
$this->factures[] = $facture;
$facture->setUser($this);
}
return $this;
}
public function removeFacture(Factures $facture): self
{
if ($this->factures->removeElement($facture)) {
// set the owning side to null (unless already changed)
if ($facture->getUser() === $this) {
$facture->setUser(null);
}
}
return $this;
}
}