<?php
namespace App\Entity;
use App\Repository\ModUserRepository;
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;
/**
* @ORM\Entity(repositoryClass=ModUserRepository::class)
*/
class ModUser implements UserInterface, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=180, unique=true)
*/
private $username;
/**
* @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 $email;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $telephone;
/**
* @ORM\Column(type="boolean")
*/
private $cgu;
/**
* @ORM\Column(type="integer")
*/
private $actif;
/**
* @ORM\Column(type="datetime")
*/
private $dateCrea;
/**
* @ORM\Column(type="datetime")
*/
private $dateModif;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $codeVerif;
/**
* @ORM\OneToMany(targetEntity=ModPage::class, mappedBy="userCrea")
*/
private $modPages;
/**
* @ORM\OneToMany(targetEntity=ModPage::class, mappedBy="userModif")
*/
private $modPagesModif;
/**
* @ORM\OneToMany(targetEntity=ModTemplate::class, mappedBy="userCrea")
*/
private $modTemplates;
/**
* @ORM\OneToMany(targetEntity=ModElement::class, mappedBy="userCrea")
*/
private $modElementsCrea;
/**
* @ORM\OneToMany(targetEntity=ModElement::class, mappedBy="userModif")
*/
private $modElementsModif;
/**
* @ORM\OneToMany(targetEntity=ModIframe::class, mappedBy="userCrea", orphanRemoval=true)
*/
private $modIframes;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $prenom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $nom;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $societe;
public function __construct()
{
$this->modPages = new ArrayCollection();
$this->modPagesModif = new ArrayCollection();
$this->modTemplates = new ArrayCollection();
$this->modElementsCrea = new ArrayCollection();
$this->modElementsModif = new ArrayCollection();
$this->modIframes = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
/**
* @deprecated since Symfony 5.3, use getUserIdentifier instead
*/
public function getUsername(): string
{
return (string) $this->username;
}
public function setUsername(string $username): self
{
$this->username = $username;
return $this;
}
/**
* A visual identifier that represents this user.
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->username;
}
/**
* @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 getTelephone(): ?string
{
return $this->telephone;
}
public function setTelephone(?string $telephone): self
{
$this->telephone = $telephone;
return $this;
}
public function isCgu(): ?bool
{
return $this->cgu;
}
public function setCgu(bool $cgu): self
{
$this->cgu = $cgu;
return $this;
}
public function getActif(): ?int
{
return $this->actif;
}
public function setActif(int $actif): self
{
$this->actif = $actif;
return $this;
}
public function getDateCrea(): ?\DateTimeInterface
{
return $this->dateCrea;
}
public function setDateCrea(\DateTimeInterface $dateCrea): self
{
$this->dateCrea = $dateCrea;
return $this;
}
public function getDateModif(): ?\DateTimeInterface
{
return $this->dateModif;
}
public function setDateModif(\DateTimeInterface $dateModif): self
{
$this->dateModif = $dateModif;
return $this;
}
public function getCodeVerif(): ?string
{
return $this->codeVerif;
}
public function setCodeVerif(?string $codeVerif): self
{
$this->codeVerif = $codeVerif;
return $this;
}
/**
* @return Collection<int, ModPage>
*/
public function getModPages(): Collection
{
return $this->modPages;
}
public function addModPage(ModPage $modPage): self
{
if (!$this->modPages->contains($modPage)) {
$this->modPages[] = $modPage;
$modPage->setUserCrea($this);
}
return $this;
}
public function removeModPage(ModPage $modPage): self
{
if ($this->modPages->removeElement($modPage)) {
// set the owning side to null (unless already changed)
if ($modPage->getUserCrea() === $this) {
$modPage->setUserCrea(null);
}
}
return $this;
}
/**
* @return Collection<int, ModPage>
*/
public function getModPagesModif(): Collection
{
return $this->modPagesModif;
}
public function addModPagesModif(ModPage $modPagesModif): self
{
if (!$this->modPagesModif->contains($modPagesModif)) {
$this->modPagesModif[] = $modPagesModif;
$modPagesModif->setUserModif($this);
}
return $this;
}
public function removeModPagesModif(ModPage $modPagesModif): self
{
if ($this->modPagesModif->removeElement($modPagesModif)) {
// set the owning side to null (unless already changed)
if ($modPagesModif->getUserModif() === $this) {
$modPagesModif->setUserModif(null);
}
}
return $this;
}
/**
* @return Collection<int, ModTemplate>
*/
public function getModTemplates(): Collection
{
return $this->modTemplates;
}
public function addModTemplate(ModTemplate $modTemplate): self
{
if (!$this->modTemplates->contains($modTemplate)) {
$this->modTemplates[] = $modTemplate;
$modTemplate->setUserCrea($this);
}
return $this;
}
public function removeModTemplate(ModTemplate $modTemplate): self
{
if ($this->modTemplates->removeElement($modTemplate)) {
// set the owning side to null (unless already changed)
if ($modTemplate->getUserCrea() === $this) {
$modTemplate->setUserCrea(null);
}
}
return $this;
}
/**
* @return Collection<int, ModElement>
*/
public function getModElementsCrea(): Collection
{
return $this->modElementsCrea;
}
public function addModElementsCrea(ModElement $modElementsCrea): self
{
if (!$this->modElementsCrea->contains($modElementsCrea)) {
$this->modElementsCrea[] = $modElementsCrea;
$modElementsCrea->setUserCrea($this);
}
return $this;
}
public function removeModElementsCrea(ModElement $modElementsCrea): self
{
if ($this->modElementsCrea->removeElement($modElementsCrea)) {
// set the owning side to null (unless already changed)
if ($modElementsCrea->getUserCrea() === $this) {
$modElementsCrea->setUserCrea(null);
}
}
return $this;
}
/**
* @return Collection<int, ModElement>
*/
public function getModElementsModif(): Collection
{
return $this->modElementsModif;
}
public function addModElementsModif(ModElement $modElementsModif): self
{
if (!$this->modElementsModif->contains($modElementsModif)) {
$this->modElementsModif[] = $modElementsModif;
$modElementsModif->setUserModif($this);
}
return $this;
}
public function removeModElementsModif(ModElement $modElementsModif): self
{
if ($this->modElementsModif->removeElement($modElementsModif)) {
// set the owning side to null (unless already changed)
if ($modElementsModif->getUserModif() === $this) {
$modElementsModif->setUserModif(null);
}
}
return $this;
}
/**
* @return Collection<int, ModIframe>
*/
public function getModIframes(): Collection
{
return $this->modIframes;
}
public function addModIframe(ModIframe $modIframe): self
{
if (!$this->modIframes->contains($modIframe)) {
$this->modIframes[] = $modIframe;
$modIframe->setUserCrea($this);
}
return $this;
}
public function removeModIframe(ModIframe $modIframe): self
{
if ($this->modIframes->removeElement($modIframe)) {
// set the owning side to null (unless already changed)
if ($modIframe->getUserCrea() === $this) {
$modIframe->setUserCrea(null);
}
}
return $this;
}
public function getPrenom(): ?string
{
return $this->prenom;
}
public function setPrenom(?string $prenom): self
{
$this->prenom = $prenom;
return $this;
}
public function getNom(): ?string
{
return $this->nom;
}
public function setNom(?string $nom): self
{
$this->nom = $nom;
return $this;
}
public function getSociete(): ?string
{
return $this->societe;
}
public function setSociete(?string $societe): self
{
$this->societe = $societe;
return $this;
}
}