<?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]
private ?int $id = null;
#[ORM\Column(length: 180, unique: true)]
private ?string $email = null;
#[ORM\Column]
private array $roles = [];
/**
* @var string The hashed password
*/
#[ORM\Column]
private ?string $password = null;
#[ORM\Column(type: 'boolean')]
private $isVerified = false;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Articles::class)]
private Collection $articles;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Annonces::class)]
private Collection $annonces;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Images::class)]
private Collection $images;
#[ORM\OneToMany(mappedBy: 'sender', targetEntity: Messages::class)]
private Collection $messages;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: PostLike::class)]
private Collection $postLikes;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Resetemail::class)]
private Collection $resetemails;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Visiteurs::class)]
private Collection $visiteurs;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Event::class)]
private Collection $events;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Reservations::class)]
private Collection $reservations;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Factures::class)]
private Collection $factures;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Wallet::class)]
private Collection $wallets;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Transactions::class)]
private Collection $transactions;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Alertes::class)]
private Collection $alertes;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: CommentairesLocataires::class)]
private Collection $commentairesLocataires;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: CommentairesLogements::class)]
private Collection $commentairesLogements;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: CommentairesProprietaires::class)]
private Collection $commentairesProprietaires;
#[ORM\Column(nullable: true)]
private ?\DateTimeImmutable $created_at = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $nom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $prenom = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $adresse = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $telephone = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $facebook = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $instagram = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $linkedin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $twitter = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $siteperso = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $id_google = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $slug = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $image = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $avarar_google = null;
#[ORM\ManyToOne(inversedBy: 'users')]
private ?Agences $agence = null;
#[ORM\ManyToOne(inversedBy: 'users')]
private ?Hotels $hotel = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $type = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $psedo = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $credits = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Recherche::class)]
private Collection $recherches;
#[ORM\Column(length: 255, nullable: true)]
private ?string $validation = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $domaine = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Contact::class)]
private Collection $contacts;
public function __construct()
{
$this->articles = new ArrayCollection();
$this->annonces = new ArrayCollection();
$this->images = new ArrayCollection();
$this->messages = new ArrayCollection();
$this->postLikes = new ArrayCollection();
$this->resetemails = new ArrayCollection();
$this->visiteurs = new ArrayCollection();
$this->events = new ArrayCollection();
$this->reservations = new ArrayCollection();
$this->factures = new ArrayCollection();
$this->wallets = new ArrayCollection();
$this->transactions = new ArrayCollection();
$this->alertes = new ArrayCollection();
$this->commentairesLocataires = new ArrayCollection();
$this->commentairesLogements = new ArrayCollection();
$this->commentairesProprietaires = new ArrayCollection();
$this->recherches = new ArrayCollection();
$this->contacts = 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;
}
/**
* @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;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function isVerified(): bool
{
return $this->isVerified;
}
public function setIsVerified(bool $isVerified): self
{
$this->isVerified = $isVerified;
return $this;
}
/**
* @return Collection<int, Articles>
*/
public function getArticles(): Collection
{
return $this->articles;
}
public function addArticle(Articles $article): self
{
if (!$this->articles->contains($article)) {
$this->articles->add($article);
$article->setUser($this);
}
return $this;
}
public function removeArticle(Articles $article): self
{
if ($this->articles->removeElement($article)) {
// set the owning side to null (unless already changed)
if ($article->getUser() === $this) {
$article->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->add($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, Images>
*/
public function getImages(): Collection
{
return $this->images;
}
public function addImage(Images $image): self
{
if (!$this->images->contains($image)) {
$this->images->add($image);
$image->setUser($this);
}
return $this;
}
public function removeImage(Images $image): self
{
if ($this->images->removeElement($image)) {
// set the owning side to null (unless already changed)
if ($image->getUser() === $this) {
$image->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Messages>
*/
public function getMessages(): Collection
{
return $this->messages;
}
public function addMessage(Messages $message): self
{
if (!$this->messages->contains($message)) {
$this->messages->add($message);
$message->setSender($this);
}
return $this;
}
public function removeMessage(Messages $message): self
{
if ($this->messages->removeElement($message)) {
// set the owning side to null (unless already changed)
if ($message->getSender() === $this) {
$message->setSender(null);
}
}
return $this;
}
/**
* @return Collection<int, PostLike>
*/
public function getPostLikes(): Collection
{
return $this->postLikes;
}
public function addPostLike(PostLike $postLike): self
{
if (!$this->postLikes->contains($postLike)) {
$this->postLikes->add($postLike);
$postLike->setUser($this);
}
return $this;
}
public function removePostLike(PostLike $postLike): self
{
if ($this->postLikes->removeElement($postLike)) {
// set the owning side to null (unless already changed)
if ($postLike->getUser() === $this) {
$postLike->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Resetemail>
*/
public function getResetemails(): Collection
{
return $this->resetemails;
}
public function addResetemail(Resetemail $resetemail): self
{
if (!$this->resetemails->contains($resetemail)) {
$this->resetemails->add($resetemail);
$resetemail->setUser($this);
}
return $this;
}
public function removeResetemail(Resetemail $resetemail): self
{
if ($this->resetemails->removeElement($resetemail)) {
// set the owning side to null (unless already changed)
if ($resetemail->getUser() === $this) {
$resetemail->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Visiteurs>
*/
public function getVisiteurs(): Collection
{
return $this->visiteurs;
}
public function addVisiteur(Visiteurs $visiteur): self
{
if (!$this->visiteurs->contains($visiteur)) {
$this->visiteurs->add($visiteur);
$visiteur->setUser($this);
}
return $this;
}
public function removeVisiteur(Visiteurs $visiteur): self
{
if ($this->visiteurs->removeElement($visiteur)) {
// set the owning side to null (unless already changed)
if ($visiteur->getUser() === $this) {
$visiteur->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Event>
*/
public function getEvents(): Collection
{
return $this->events;
}
public function addEvent(Event $event): self
{
if (!$this->events->contains($event)) {
$this->events->add($event);
$event->setUser($this);
}
return $this;
}
public function removeEvent(Event $event): self
{
if ($this->events->removeElement($event)) {
// set the owning side to null (unless already changed)
if ($event->getUser() === $this) {
$event->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Reservations>
*/
public function getReservations(): Collection
{
return $this->reservations;
}
public function addReservation(Reservations $reservation): self
{
if (!$this->reservations->contains($reservation)) {
$this->reservations->add($reservation);
$reservation->setUser($this);
}
return $this;
}
public function removeReservation(Reservations $reservation): self
{
if ($this->reservations->removeElement($reservation)) {
// set the owning side to null (unless already changed)
if ($reservation->getUser() === $this) {
$reservation->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->add($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;
}
/**
* @return Collection<int, Wallet>
*/
public function getWallets(): Collection
{
return $this->wallets;
}
public function addWallet(Wallet $wallet): self
{
if (!$this->wallets->contains($wallet)) {
$this->wallets->add($wallet);
$wallet->setUser($this);
}
return $this;
}
public function removeWallet(Wallet $wallet): self
{
if ($this->wallets->removeElement($wallet)) {
// set the owning side to null (unless already changed)
if ($wallet->getUser() === $this) {
$wallet->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Transactions>
*/
public function getTransactions(): Collection
{
return $this->transactions;
}
public function addTransaction(Transactions $transaction): self
{
if (!$this->transactions->contains($transaction)) {
$this->transactions->add($transaction);
$transaction->setUser($this);
}
return $this;
}
public function removeTransaction(Transactions $transaction): self
{
if ($this->transactions->removeElement($transaction)) {
// set the owning side to null (unless already changed)
if ($transaction->getUser() === $this) {
$transaction->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->add($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;
}
/**
* @return Collection<int, CommentairesLocataires>
*/
public function getCommentairesLocataires(): Collection
{
return $this->commentairesLocataires;
}
public function addCommentairesLocataire(CommentairesLocataires $commentairesLocataire): self
{
if (!$this->commentairesLocataires->contains($commentairesLocataire)) {
$this->commentairesLocataires->add($commentairesLocataire);
$commentairesLocataire->setUser($this);
}
return $this;
}
public function removeCommentairesLocataire(CommentairesLocataires $commentairesLocataire): self
{
if ($this->commentairesLocataires->removeElement($commentairesLocataire)) {
// set the owning side to null (unless already changed)
if ($commentairesLocataire->getUser() === $this) {
$commentairesLocataire->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, CommentairesLogements>
*/
public function getCommentairesLogements(): Collection
{
return $this->commentairesLogements;
}
public function addCommentairesLogement(CommentairesLogements $commentairesLogement): self
{
if (!$this->commentairesLogements->contains($commentairesLogement)) {
$this->commentairesLogements->add($commentairesLogement);
$commentairesLogement->setUser($this);
}
return $this;
}
public function removeCommentairesLogement(CommentairesLogements $commentairesLogement): self
{
if ($this->commentairesLogements->removeElement($commentairesLogement)) {
// set the owning side to null (unless already changed)
if ($commentairesLogement->getUser() === $this) {
$commentairesLogement->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, CommentairesProprietaires>
*/
public function getCommentairesProprietaires(): Collection
{
return $this->commentairesProprietaires;
}
public function addCommentairesProprietaire(CommentairesProprietaires $commentairesProprietaire): self
{
if (!$this->commentairesProprietaires->contains($commentairesProprietaire)) {
$this->commentairesProprietaires->add($commentairesProprietaire);
$commentairesProprietaire->setUser($this);
}
return $this;
}
public function removeCommentairesProprietaire(CommentairesProprietaires $commentairesProprietaire): self
{
if ($this->commentairesProprietaires->removeElement($commentairesProprietaire)) {
// set the owning side to null (unless already changed)
if ($commentairesProprietaire->getUser() === $this) {
$commentairesProprietaire->setUser(null);
}
}
return $this;
}
public function getCreatedAt(): ?\DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(?\DateTimeImmutable $created_at): self
{
$this->created_at = $created_at;
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 getAdresse(): ?string
{
return $this->adresse;
}
public function setAdresse(?string $adresse): self
{
$this->adresse = $adresse;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getFacebook(): ?string
{
return $this->facebook;
}
public function setFacebook(?string $facebook): self
{
$this->facebook = $facebook;
return $this;
}
public function getInstagram(): ?string
{
return $this->instagram;
}
public function setInstagram(?string $instagram): self
{
$this->instagram = $instagram;
return $this;
}
public function getLinkedin(): ?string
{
return $this->linkedin;
}
public function setLinkedin(?string $linkedin): self
{
$this->linkedin = $linkedin;
return $this;
}
public function getTwitter(): ?string
{
return $this->twitter;
}
public function setTwitter(?string $twitter): self
{
$this->twitter = $twitter;
return $this;
}
public function getSiteperso(): ?string
{
return $this->siteperso;
}
public function setSiteperso(?string $siteperso): self
{
$this->siteperso = $siteperso;
return $this;
}
public function getIdGoogle(): ?string
{
return $this->id_google;
}
public function setIdGoogle(?string $id_google): self
{
$this->id_google = $id_google;
return $this;
}
public function getSlug(): ?string
{
return $this->slug;
}
public function setSlug(?string $slug): self
{
$this->slug = $slug;
return $this;
}
public function getImage(): ?string
{
return $this->image;
}
public function setImage(?string $image): self
{
$this->image = $image;
return $this;
}
public function getAvararGoogle(): ?string
{
return $this->avarar_google;
}
public function setAvararGoogle(?string $avarar_google): self
{
$this->avarar_google = $avarar_google;
return $this;
}
public function getAgence(): ?Agences
{
return $this->agence;
}
public function setAgence(?Agences $agence): self
{
$this->agence = $agence;
return $this;
}
public function getHotel(): ?Hotels
{
return $this->hotel;
}
public function setHotel(?Hotels $hotel): self
{
$this->hotel = $hotel;
return $this;
}
public function getType(): ?string
{
return $this->type;
}
public function setType(?string $type): self
{
$this->type = $type;
return $this;
}
public function getPsedo(): ?string
{
return $this->psedo;
}
public function setPsedo(?string $psedo): self
{
$this->psedo = $psedo;
return $this;
}
public function getCredits(): ?string
{
return $this->credits;
}
public function setCredits(?string $credits): self
{
$this->credits = $credits;
return $this;
}
/**
* @return Collection<int, Recherche>
*/
public function getRecherches(): Collection
{
return $this->recherches;
}
public function addRecherch(Recherche $recherch): self
{
if (!$this->recherches->contains($recherch)) {
$this->recherches->add($recherch);
$recherch->setUser($this);
}
return $this;
}
public function removeRecherch(Recherche $recherch): self
{
if ($this->recherches->removeElement($recherch)) {
// set the owning side to null (unless already changed)
if ($recherch->getUser() === $this) {
$recherch->setUser(null);
}
}
return $this;
}
public function getValidation(): ?string
{
return $this->validation;
}
public function setValidation(?string $validation): self
{
$this->validation = $validation;
return $this;
}
public function getDomaine(): ?string
{
return $this->domaine;
}
public function setDomaine(?string $domaine): self
{
$this->domaine = $domaine;
return $this;
}
/**
* @return Collection<int, Contact>
*/
public function getContacts(): Collection
{
return $this->contacts;
}
public function addContact(Contact $contact): self
{
if (!$this->contacts->contains($contact)) {
$this->contacts->add($contact);
$contact->setUser($this);
}
return $this;
}
public function removeContact(Contact $contact): self
{
if ($this->contacts->removeElement($contact)) {
// set the owning side to null (unless already changed)
if ($contact->getUser() === $this) {
$contact->setUser(null);
}
}
return $this;
}
}