<?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\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
use Rollerworks\Component\PasswordStrength\Validator\Constraints as RollerworksPassword;
/**
* @ORM\Entity(repositoryClass=UserRepository::class)
*/
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
* @RollerworksPassword\PasswordStrength(
* minLength=8,
* minStrength=3,
* tooShortMessage = "Le mot de passe doit comporter au moins 8 caractères",
* message = "Doit contenir au moins 8 caractères dont au moins une lettre majuscule, une lettre minuscule et une chiffre",
* )
* @ORM\Column(type="string")
*/
private $password;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $civilite;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $nom;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $prenom;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $telephone;
/**
* @ORM\Column(type="string", length=10, nullable=true)
*/
private $departement;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $fonction;
/**
* @ORM\ManyToOne(targetEntity=Cinema::class, inversedBy="users")
*/
private $cinema;
/**
* @ORM\Column(type="string", length=50, nullable=true)
*/
private $cinemaGestion;
/**
* @ORM\ManyToOne(targetEntity=Beneficiaire::class, inversedBy="users")
*/
private $beneficiaire;
/**
* @ORM\Column(type="string", length=15, nullable=true)
*/
private $politiqueTarifaireDptGestion;
public function __construct()
{
$this->faqs = 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 getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function getDepartement(): ?string
{
return $this->departement;
}
public function setDepartement(?string $departement): self
{
$this->departement = $departement;
return $this;
}
public function getFonction(): ?string
{
return $this->fonction;
}
public function setFonction(?string $fonction): self
{
$this->fonction = $fonction;
return $this;
}
public function getCinema(): ?Cinema
{
return $this->cinema;
}
public function setCinema(?Cinema $cinema): self
{
$this->cinema = $cinema;
return $this;
}
public function getCinemaGestion(): ?string
{
return $this->cinemaGestion;
}
public function setCinemaGestion(?string $cinemaGestion): self
{
$this->cinemaGestion = $cinemaGestion;
return $this;
}
public function getBeneficiaire(): ?Beneficiaire
{
return $this->beneficiaire;
}
public function setBeneficiaire(?Beneficiaire $beneficiaire): self
{
$this->beneficiaire = $beneficiaire;
return $this;
}
public function getPolitiqueTarifaireDptGestion(): ?string
{
return $this->politiqueTarifaireDptGestion;
}
public function setPolitiqueTarifaireDptGestion(?string $politiqueTarifaireDptGestion): self
{
$this->politiqueTarifaireDptGestion = $politiqueTarifaireDptGestion;
return $this;
}
}