<?php
namespace App\Entity;
use App\Entity\Trait\CreatedAtTrait;
use App\Repository\UsersRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UsersRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
//#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
class Users implements UserInterface, PasswordAuthenticatedUserInterface
{
use CreatedAtTrait;
#[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(length: 100)]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $lastname = null;
#[ORM\Column(length: 100)]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $firstname = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $address = null;
#[ORM\Column(length: 20)]
private ?string $zipcode = null;
#[ORM\Column(length: 150)]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $city = null;
#[ORM\Column(type: 'boolean')]
private $is_verified = false;
/// #[ORM\Column(nullable: true)]
/// private ?bool $Autorisation = null;
#[ORM\Column(nullable: true)]
private ?bool $Autorisation = null;
// #[ORM\Column(length: 100)]
// private ?string $resetToken = null;
#[ORM\Column(length: 100)]
private $resetToken = false;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Orders::class)]
private Collection $orders;
#[ORM\OneToMany(mappedBy: 'Users', targetEntity: Products::class, orphanRemoval: true)]
private Collection $products;
#[ORM\Column(length: 255)]
private ?string $imageUser = null;
#[ORM\OneToMany(mappedBy: 'Users', targetEntity: Projects::class, orphanRemoval: true)]
private Collection $projects;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Immobiliers::class, orphanRemoval: true)]
private Collection $immobiliers;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Hebergements::class)]
private Collection $hebergements;
/*
#[ORM\Column]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?int $phonePublic = null;
#[ORM\Column(nullable: true)]
private ?int $phonePrivate = null;
*/
#[ORM\Column(length: 255)]
//#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $imageCouverture = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $job = null;
#[ORM\Column(length: 255)]
#[Assert\NotBlank(message: 'Ce champs est obligatoire')]
private ?string $country = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $emailPhoneSecured = null;
#[ORM\Column(type: Types::BIGINT)]
private ?string $phonePublic = null;
#[ORM\Column(type: Types::BIGINT, nullable: true)]
private ?string $phonePrivate = null;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Prestations::class)]
private Collection $prestations;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Entreprises::class)]
private Collection $entreprises;
#[ORM\Column(length: 255, nullable: true)]
private ?string $siteWeb = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $mediaSocial1 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $mediaSocial2 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $mediaSocial3 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $mediaSocial4 = null;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $mediaSocial5 = null;
#[ORM\Column(nullable: true)]
private ?bool $creationEntreprise = null;
#[ORM\Column(nullable: true)]
private ?bool $creationHebergement = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mediaSocialName1 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mediaSocialName2 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mediaSocialName3 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mediaSocialName4 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $mediaSocialName5 = null;
#[ORM\ManyToOne(inversedBy: 'users')]
private ?CategoriesUsers $categoriesusers = null;
#[ORM\Column(nullable: true)]
private ?bool $visibilitySearch = null;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Emplois::class)]
private Collection $emplois;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Annonces::class)]
private Collection $annonces;
#[ORM\Column(nullable: true)]
private ?bool $accessCv = null;
#[ORM\Column(nullable: true)]
private ?bool $creationAnnonce = null;
#[ORM\Column(nullable: true)]
private ?bool $creationEmploi = null;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Videos::class)]
private Collection $videos;
#[ORM\Column]
private ?bool $creationVideo = null;
#[ORM\OneToMany(mappedBy: 'users', targetEntity: Statistiques::class)]
private Collection $statistiques;
#[ORM\Column(nullable: true)]
private ?bool $homeAutorisation = null;
#[ORM\Column(nullable: true)]
private ?bool $bannerAutorisation = null;
#[ORM\Column(nullable: true)]
private ?bool $publicityAutorisation = null;
public function __construct()
{
$this->orders = new ArrayCollection();
$this->created_at = new \DateTimeImmutable();
/// $this->createdAt = new \DateTimeImmutable(); /////////////////
$this->products = new ArrayCollection();
$this->projects = new ArrayCollection();
$this->immobiliers = new ArrayCollection();
$this->hebergements = new ArrayCollection();
$this->prestations = new ArrayCollection();
$this->entreprises = new ArrayCollection();
$this->emplois = new ArrayCollection();
$this->annonces = new ArrayCollection();
$this->videos = new ArrayCollection();
$this->statistiques = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): static
{
$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): static
{
$this->roles = $roles;
return $this;
}
/**
* @see PasswordAuthenticatedUserInterface
*/
public function getPassword(): string
{
return $this->password;
}
public function setPassword(string $password): static
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials(): void
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getLastname(): ?string
{
return $this->lastname;
}
public function setLastname(string $lastname): static
{
$this->lastname = $lastname;
return $this;
}
public function getFirstname(): ?string
{
return $this->firstname;
}
public function setFirstname(string $firstname): static
{
$this->firstname = $firstname;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(string $address): static
{
$this->address = $address;
return $this;
}
public function getZipcode(): ?string
{
return $this->zipcode;
}
public function setZipcode(string $zipcode): static
{
$this->zipcode = $zipcode;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(string $city): static
{
$this->city = $city;
return $this;
}
public function getIsVerified(): ?bool
{
return $this->is_verified;
}
public function setIsVerified(bool $is_verified): self
{
$this->is_verified = $is_verified;
return $this;
}
public function getResetToken(): ?string
{
return $this->resetToken;
}
public function setResetToken(?string $resetToken): self
{
$this->resetToken = $resetToken;
return $this;
}
/**
* @return Collection<int, Orders>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Orders $order): static
{
if (!$this->orders->contains($order)) {
$this->orders->add($order);
$order->setUsers($this);
}
return $this;
}
public function removeOrder(Orders $order): static
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getUsers() === $this) {
$order->setUsers(null);
}
}
return $this;
}
/**
* @return Collection<int, Products>
*/
public function getProducts(): Collection
{
return $this->products;
}
/******** */
public function addProduct(Products $product): static
{
if (!$this->products->contains($product)) {
$this->products->add($product);
$product->setUsers($this); ////*** */
}
return $this;
}
public function removeProduct(Products $product): static
{
if ($this->products->removeElement($product)) {
// set the owning side to null (unless already changed)
if ($product->getUsers() === $this) {
$product->setUsers(null);
}
}
return $this;
}
/********/
public function getImageUser(): ?string
{
return $this->imageUser;
}
public function setImageUser(string $imageUser): static
{
$this->imageUser = $imageUser;
return $this;
}
/**
* @return Collection<int, Projects>
*/
public function getProjects(): Collection
{
return $this->projects;
}
public function addProject(Projects $project): static
{
if (!$this->projects->contains($project)) {
$this->projects->add($project);
$project->setUsers($this);
}
return $this;
}
public function removeProject(Projects $project): static
{
if ($this->projects->removeElement($project)) {
// set the owning side to null (unless already changed)
if ($project->getUsers() === $this) {
$project->setUsers(null);
}
}
return $this;
}
/**
* @return Collection<int, Immobiliers>
*/
public function getImmobiliers(): Collection
{
return $this->immobiliers;
}
public function addImmobilier(Immobiliers $immobilier): static
{
if (!$this->immobiliers->contains($immobilier)) {
$this->immobiliers->add($immobilier);
$immobilier->setUsers($this);
}
return $this;
}
public function removeImmobilier(Immobiliers $immobilier): static
{
if ($this->immobiliers->removeElement($immobilier)) {
// set the owning side to null (unless already changed)
if ($immobilier->getUsers() === $this) {
$immobilier->setUsers(null);
}
}
return $this;
}
/**
* @return Collection<int, Hebergements>
*/
public function getHebergements(): Collection
{
return $this->hebergements;
}
public function addHebergement(Hebergements $hebergement): static
{
if (!$this->hebergements->contains($hebergement)) {
$this->hebergements->add($hebergement);
$hebergement->setUsers($this);
}
return $this;
}
public function removeHebergement(Hebergements $hebergement): static
{
if ($this->hebergements->removeElement($hebergement)) {
// set the owning side to null (unless already changed)
if ($hebergement->getUsers() === $this) {
$hebergement->setUsers(null);
}
}
return $this;
}
/*
public function getPhonePublic(): ?int
{
return $this->phonePublic;
}
public function setPhonePublic(int $phonePublic): static
{
$this->phonePublic = $phonePublic;
return $this;
}
public function getPhonePrivate(): ?int
{
return $this->phonePrivate;
}
public function setPhonePrivate(?int $phonePrivate): static
{
$this->phonePrivate = $phonePrivate;
return $this;
}
*/
public function getImageCouverture(): ?string
{
return $this->imageCouverture;
}
public function setImageCouverture(string $imageCouverture): static
{
$this->imageCouverture = $imageCouverture;
return $this;
}
public function getJob(): ?string
{
return $this->job;
}
public function setJob(string $job): static
{
$this->job = $job;
return $this;
}
public function getCountry(): ?string
{
return $this->country;
}
public function setCountry(string $country): static
{
$this->country = $country;
return $this;
}
public function getEmailPhoneSecured(): ?string
{
return $this->emailPhoneSecured;
}
public function setEmailPhoneSecured(?string $emailPhoneSecured): static
{
$this->emailPhoneSecured = $emailPhoneSecured;
return $this;
}
public function getPhonePublic(): ?string
{
return $this->phonePublic;
}
public function setPhonePublic(string $phonePublic): static
{
$this->phonePublic = $phonePublic;
return $this;
}
public function getPhonePrivate(): ?string
{
return $this->phonePrivate;
}
public function setPhonePrivate(?string $phonePrivate): static
{
$this->phonePrivate = $phonePrivate;
return $this;
}
/**
* @return Collection<int, Prestations>
*/
public function getPrestations(): Collection
{
return $this->prestations;
}
public function addPrestation(Prestations $prestation): static
{
if (!$this->prestations->contains($prestation)) {
$this->prestations->add($prestation);
$prestation->setUsers($this);
}
return $this;
}
public function removePrestation(Prestations $prestation): static
{
if ($this->prestations->removeElement($prestation)) {
// set the owning side to null (unless already changed)
if ($prestation->getUsers() === $this) {
$prestation->setUsers(null);
}
}
return $this;
}
public function isAutorisation(): ?bool
{
return $this->Autorisation;
}
public function setAutorisation(?bool $Autorisation): static
{
$this->Autorisation = $Autorisation;
return $this;
}
/**
* @return Collection<int, Entreprises>
*/
public function getEntreprises(): Collection
{
return $this->entreprises;
}
public function addEntreprise(Entreprises $entreprise): static
{
if (!$this->entreprises->contains($entreprise)) {
$this->entreprises->add($entreprise);
$entreprise->setUsers($this);
}
return $this;
}
public function removeEntreprise(Entreprises $entreprise): static
{
if ($this->entreprises->removeElement($entreprise)) {
// set the owning side to null (unless already changed)
if ($entreprise->getUsers() === $this) {
$entreprise->setUsers(null);
}
}
return $this;
}
public function getSiteWeb(): ?string
{
return $this->siteWeb;
}
public function setSiteWeb(?string $siteWeb): static
{
$this->siteWeb = $siteWeb;
return $this;
}
public function getMediaSocial1(): ?string
{
return $this->mediaSocial1;
}
public function setMediaSocial1(?string $mediaSocial1): static
{
$this->mediaSocial1 = $mediaSocial1;
return $this;
}
public function getMediaSocial2(): ?string
{
return $this->mediaSocial2;
}
public function setMediaSocial2(?string $mediaSocial2): static
{
$this->mediaSocial2 = $mediaSocial2;
return $this;
}
public function getMediaSocial3(): ?string
{
return $this->mediaSocial3;
}
public function setMediaSocial3(?string $mediaSocial3): static
{
$this->mediaSocial3 = $mediaSocial3;
return $this;
}
public function getMediaSocial4(): ?string
{
return $this->mediaSocial4;
}
public function setMediaSocial4(?string $mediaSocial4): static
{
$this->mediaSocial4 = $mediaSocial4;
return $this;
}
public function getMediaSocial5(): ?string
{
return $this->mediaSocial5;
}
public function setMediaSocial5(?string $mediaSocial5): static
{
$this->mediaSocial5 = $mediaSocial5;
return $this;
}
public function isCreationEntreprise(): ?bool
{
return $this->creationEntreprise;
}
public function setCreationEntreprise(?bool $creationEntreprise): static
{
$this->creationEntreprise = $creationEntreprise;
return $this;
}
public function isCreationHebergement(): ?bool
{
return $this->creationHebergement;
}
public function setCreationHebergement(?bool $creationHebergement): static
{
$this->creationHebergement = $creationHebergement;
return $this;
}
public function getMediaSocialName1(): ?string
{
return $this->mediaSocialName1;
}
public function setMediaSocialName1(?string $mediaSocialName1): static
{
$this->mediaSocialName1 = $mediaSocialName1;
return $this;
}
public function getMediaSocialName2(): ?string
{
return $this->mediaSocialName2;
}
public function setMediaSocialName2(?string $mediaSocialName2): static
{
$this->mediaSocialName2 = $mediaSocialName2;
return $this;
}
public function getMediaSocialName3(): ?string
{
return $this->mediaSocialName3;
}
public function setMediaSocialName3(?string $mediaSocialName3): static
{
$this->mediaSocialName3 = $mediaSocialName3;
return $this;
}
public function getMediaSocialName4(): ?string
{
return $this->mediaSocialName4;
}
public function setMediaSocialName4(?string $mediaSocialName4): static
{
$this->mediaSocialName4 = $mediaSocialName4;
return $this;
}
public function getMediaSocialName5(): ?string
{
return $this->mediaSocialName5;
}
public function setMediaSocialName5(?string $mediaSocialName5): static
{
$this->mediaSocialName5 = $mediaSocialName5;
return $this;
}
public function getCategoriesusers(): ?CategoriesUsers
{
return $this->categoriesusers;
}
public function setCategoriesusers(?CategoriesUsers $categoriesusers): static
{
$this->categoriesusers = $categoriesusers;
return $this;
}
public function isVisibilitySearch(): ?bool
{
return $this->visibilitySearch;
}
public function setVisibilitySearch(?bool $visibilitySearch): static
{
$this->visibilitySearch = $visibilitySearch;
return $this;
}
/**
* @return Collection<int, Emplois>
*/
public function getEmplois(): Collection
{
return $this->emplois;
}
public function addEmploi(Emplois $emploi): static
{
if (!$this->emplois->contains($emploi)) {
$this->emplois->add($emploi);
$emploi->setUsers($this);
}
return $this;
}
public function removeEmploi(Emplois $emploi): static
{
if ($this->emplois->removeElement($emploi)) {
// set the owning side to null (unless already changed)
if ($emploi->getUsers() === $this) {
$emploi->setUsers(null);
}
}
return $this;
}
/**
* @return Collection<int, Annonces>
*/
public function getAnnonces(): Collection
{
return $this->annonces;
}
public function addAnnonce(Annonces $annonce): static
{
if (!$this->annonces->contains($annonce)) {
$this->annonces->add($annonce);
$annonce->setUsers($this);
}
return $this;
}
public function removeAnnonce(Annonces $annonce): static
{
if ($this->annonces->removeElement($annonce)) {
// set the owning side to null (unless already changed)
if ($annonce->getUsers() === $this) {
$annonce->setUsers(null);
}
}
return $this;
}
public function isAccessCv(): ?bool
{
return $this->accessCv;
}
public function setAccessCv(?bool $accessCv): static
{
$this->accessCv = $accessCv;
return $this;
}
public function isCreationAnnonce(): ?bool
{
return $this->creationAnnonce;
}
public function setCreationAnnonce(?bool $creationAnnonce): static
{
$this->creationAnnonce = $creationAnnonce;
return $this;
}
public function isCreationEmploi(): ?bool
{
return $this->creationEmploi;
}
public function setCreationEmploi(?bool $creationEmploi): static
{
$this->creationEmploi = $creationEmploi;
return $this;
}
/**
* @return Collection<int, Videos>
*/
public function getVideos(): Collection
{
return $this->videos;
}
public function addVideo(Videos $video): static
{
if (!$this->videos->contains($video)) {
$this->videos->add($video);
$video->setUsers($this);
}
return $this;
}
public function removeVideo(Videos $video): static
{
if ($this->videos->removeElement($video)) {
// set the owning side to null (unless already changed)
if ($video->getUsers() === $this) {
$video->setUsers(null);
}
}
return $this;
}
public function isCreationVideo(): ?bool
{
return $this->creationVideo;
}
public function setCreationVideo(bool $creationVideo): static
{
$this->creationVideo = $creationVideo;
return $this;
}
/**
* @return Collection<int, Statistiques>
*/
public function getStatistiques(): Collection
{
return $this->statistiques;
}
public function addStatistique(Statistiques $statistique): static
{
if (!$this->statistiques->contains($statistique)) {
$this->statistiques->add($statistique);
$statistique->setUsers($this);
}
return $this;
}
public function removeStatistique(Statistiques $statistique): static
{
if ($this->statistiques->removeElement($statistique)) {
// set the owning side to null (unless already changed)
if ($statistique->getUsers() === $this) {
$statistique->setUsers(null);
}
}
return $this;
}
public function isHomeAutorisation(): ?bool
{
return $this->homeAutorisation;
}
public function setHomeAutorisation(?bool $homeAutorisation): static
{
$this->homeAutorisation = $homeAutorisation;
return $this;
}
public function isBannerAutorisation(): ?bool
{
return $this->bannerAutorisation;
}
public function setBannerAutorisation(?bool $bannerAutorisation): static
{
$this->bannerAutorisation = $bannerAutorisation;
return $this;
}
public function isPublicityAutorisation(): ?bool
{
return $this->publicityAutorisation;
}
public function setPublicityAutorisation(?bool $publicityAutorisation): static
{
$this->publicityAutorisation = $publicityAutorisation;
return $this;
}
}