<?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={"Entreprise","email"}, message="On compte existe déjà sous ce nom d'entreprise")
*/
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
private $Entreprise;
/**
* @ORM\Column(type="json")
*/
private $roles = [];
/**
* @var string The hashed password
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\Column(type="string", length=255, unique=true)
*/
private $email;
/**
* @ORM\Column(type="datetime")
*/
private $date_echeance;
/**
* @ORM\Column(type="integer")
*/
private $etat;
/**
* @ORM\OneToMany(targetEntity=Cuvee::class, mappedBy="user")
*/
private $cuvees;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $adresse;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $code_postal;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $ville;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $telephone;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $site;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $instagram;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $facebook;
/**
* @ORM\Column(type="text", nullable=true)
*/
private $texte_domaine;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image_profil;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $image_fond_profil;
public function __construct()
{
$this->cuvees = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getEntreprise(): ?string
{
return $this->Entreprise;
}
public function setEntreprise(string $Entreprise): self
{
$this->Entreprise = $Entreprise;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->Entreprise;
}
/**
* @deprecated since Symfony 5.3, use getUserIdentifier instead
*/
public function getUsername(): string
{
return (string) $this->Entreprise;
}
/**
* @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 getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function getDateEcheance(): ?\DateTimeInterface
{
return $this->date_echeance;
}
public function setDateEcheance(\DateTimeInterface $date_echeance): self
{
$this->date_echeance = $date_echeance;
return $this;
}
public function getEtat(): ?int
{
return $this->etat;
}
public function setEtat(int $etat): self
{
$this->etat = $etat;
return $this;
}
/**
* @return Collection<int, Cuvee>
*/
public function getCuvees(): Collection
{
return $this->cuvees;
}
public function addCuvee(Cuvee $cuvee): self
{
if (!$this->cuvees->contains($cuvee)) {
$this->cuvees[] = $cuvee;
$cuvee->setUser($this);
}
return $this;
}
public function removeCuvee(Cuvee $cuvee): self
{
if ($this->cuvees->removeElement($cuvee)) {
// set the owning side to null (unless already changed)
if ($cuvee->getUser() === $this) {
$cuvee->setUser(null);
}
}
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->code_postal;
}
public function setCodePostal(?string $code_postal): self
{
$this->code_postal = $code_postal;
return $this;
}
public function getVille(): ?string
{
return $this->ville;
}
public function setVille(?string $ville): self
{
$this->ville = $ville;
return $this;
}
public function getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getSite(): ?string
{
return $this->site;
}
public function setSite(?string $site): self
{
$this->site = $site;
return $this;
}
public function getInstagram(): ?string
{
return $this->instagram;
}
public function setInstagram(?string $instagram): self
{
$this->instagram = $instagram;
return $this;
}
public function getFacebook(): ?string
{
return $this->facebook;
}
public function setFacebook(?string $facebook): self
{
$this->facebook = $facebook;
return $this;
}
public function getTexteDomaine(): ?string
{
return $this->texte_domaine;
}
public function setTexteDomaine(?string $texte_domaine): self
{
$this->texte_domaine = $texte_domaine;
return $this;
}
public function getImageProfil(): ?string
{
return $this->image_profil;
}
public function setImageProfil(?string $image_profil): self
{
$this->image_profil = $image_profil;
return $this;
}
public function getImageFondProfil(): ?string
{
return $this->image_fond_profil;
}
public function setImageFondProfil(?string $image_fond_profil): self
{
$this->image_fond_profil = $image_fond_profil;
return $this;
}
}