<?php
namespace App\Entity;
use App\Repository\UsuariRepository;
use Doctrine\ORM\Mapping as ORM;
//use phpDocumentor\Reflection\Types\Boolean;
use phpDocumentor\Reflection\Types\Integer;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Usuari
*/
#[ORM\Table("Usuari")]
#[ORM\Entity(repositoryClass:"App\Repository\UsuariRepository")]
class Usuari implements UserInterface, PasswordAuthenticatedUserInterface, \Serializable
{
/**
* @var integer
*/
#[ORM\Column(name:"id", type:"integer")]
#[ORM\Id]
#[ORM\GeneratedValue(strategy:"AUTO")]
private $id;
/**
* @var string
*/
#[ORM\Column(name:"nom", type:"string", length:255, nullable:true)]
private $nom;
/**
* @var boolean
*/
#[ORM\Column(name:"superadmin", type:"boolean")]
private $superadmin;
/**
* @var ?string
*/
#[Assert\Length(min : 6)]
#[ORM\Column(name:"password", type:"string", length:255)]
private ?string $password;
/**
* @var string
*/
#[Assert\NotBlank()]
#[Assert\Email()]
#[ORM\Column(name:"email", type:"string", length:255, unique:true)]
private $email;
/**
* @var string
*/
#[ORM\Column(name:"salt", type:"string", length:255)]
private $salt;
/**
* @var \DateTime
*/
#[ORM\Column(name:"data_alta", type:"datetime")]
private $dataAlta;
/**
* @var boolean
*/
#[ORM\Column(name:"activat", type:"boolean", nullable:true)]
protected $activat;
#[ORM\ManyToOne(targetEntity:"App\Entity\Idioma")]
private $idioma;
#[ORM\ManyToOne(targetEntity:"App\Entity\Perfils")]
#[ORM\JoinColumn(name:"perfils_id", referencedColumnName:"per_id")]
private $perfils;
#[ORM\Column(name:"direccio", type:"string", length:255, nullable:true)]
protected $direccio;
#[ORM\Column(name:"cp", type:"string", length:10, nullable:true)]
protected $cp;
#[ORM\Column(name:"poblacio", type:"string", length:255, nullable:true)]
protected $poblacio;
#[ORM\Column(name:"telefon", type:"string", length:15, nullable:true)]
protected $telefon;
/**
* @var string
*/
#[ORM\Column(name:"responsable", type:"string", length:255, nullable:true)]
private $responsable;
/**
* @var string
*/
#[ORM\Column(name:"codi", type:"string", length:255, nullable:true)]
private $codi;
/**
* @var boolean
*/
#[ORM\Column(name:"club_esqui", type:"boolean")]
private $clubEsqui;
#[ORM\Column(name:"cada_quants_gratuit", type:"integer", nullable:true)]
protected $cadaQuantsGratuit;
#[ORM\Column(name:"quants_gratuit_fets", type:"integer", nullable:true)]
protected $quantsGratuitFets;
#[ORM\Column(name:"cada_quants_gratuit_alp", type:"integer", nullable:true)]
protected $cadaQuantsGratuitAlp;
#[ORM\Column(name:"quants_gratuit_fets_alp", type:"integer", nullable:true)]
protected $quantsGratuitFetsAlp;
/**
* @var boolean
*/
#[ORM\Column(name:"clubs1", type:"boolean", nullable:true)]
private $clubs1;
/**
* @var boolean
*/
#[ORM\Column(name:"clubs2", type:"boolean", nullable:true)]
private $clubs2;
/**
* @var boolean
*/
#[ORM\Column(name:"clubs3", type:"boolean", nullable:true)]
private $clubs3;
/**
* @var boolean
*/
#[ORM\Column(name:"clubs4", type:"boolean", nullable:true)]
private $clubs4;
/**
* @var boolean
*/
#[ORM\Column(name:"lloc_central", type:"boolean", nullable:true)]
private $llocCentral;
/**
* @var boolean
*/
#[ORM\Column(name:"lloc_fira", type:"boolean", nullable:true)]
private $llocFira;
/**
* @var boolean
*/
#[ORM\Column(name:"lloc_oficina", type:"boolean", nullable:true)]
private $llocOficina;
/**
* @var boolean
*/
#[ORM\Column(name:"lloc_clubs", type:"boolean", nullable:true)]
private $llocClubs;
/**
* @var boolean
*/
#[ORM\Column(name:"lloc_web", type:"boolean", nullable:true)]
private $llocWeb;
public function __construct()
{
$this->dataAlta = new \DateTime();
$this->superadmin = false;
$this->clubs1 = false;
$this->clubs2 = false;
$this->clubs3 = false;
$this->clubs4 = false;
$this->llocCentral = false;
$this->llocFira = false;
$this->llocOficina = false;
$this->llocClubs = false;
$this->llocWeb = false;
}
public function __sleep()
{
return array('id', 'email');
}
/**
* Get id
*
* @return integer
*/
public function getId(): int
{
return $this->id;
}
/**
* Set nom
*
* @param string $nom
* @return Usuari
*/
public function setNom(string $nom): self
{
$this->nom = $nom;
return $this;
}
/**
* Get nom
*
* @return string
*/
public function getNom(): string
{
return $this->nom;
}
/**
* Set password
*
* @param string|null $password
* @return Usuari
*/
public function setPassword(? string $password): self
{
$this->password = $password;
return $this;
}
/**
* Get password
*
* @return string|null
* @see PasswordAuthenticatedUserInterface
*
*/
public function getPassword(): ?string
{
return $this->password;
}
/**
* Set email
*
* @param string $email
* @return Usuari
*/
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
/**
* Get email
*
* @return string
*/
public function getEmail(): string
{
return $this->email;
}
/**
* Set superadmin
*
* @param boolean $superadmin
* @return Usuari
*/
public function setSuperadmin($superadmin): self
{
$this->superadmin = $superadmin;
return $this;
}
/**
* Get superadmin
*
* @return boolean
*/
public function getSuperadmin()
{
return $this->superadmin;
}
/**
* Set salt
*
* @param string $salt
* @return Usuari
*/
public function setSalt(string $salt): self
{
$this->salt = $salt;
return $this;
}
/**
* Get salt
* @see UserInterface
*
* @return string
*/
public function getSalt(): ?string
{
return $this->salt;
}
/**
* Set dataAlta
*
* @param \DateTime $dataAlta
* @return Usuari
*/
public function setDataAlta(\DateTime $dataAlta): self
{
$this->dataAlta = $dataAlta;
return $this;
}
/**
* Get dataAlta
*
* @return \DateTime
*/
public function getDataAlta()
{
return $this->dataAlta;
}
public function __toString()
{
return $this->getNom();
}
/**
* Set activat
*
* @param boolean $activat
* @return Usuari
*/
public function setActivat($activat)
{
$this->activat = $activat;
return $this;
}
/**
* Get activat
*
* @return boolean
*/
public function getActivat()
{
return $this->activat;
}
function getUsername() : string
{
return $this->getEmail();
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
if ($this->superadmin) {
return array('ROLE_SUPER_ADMIN');
} elseif ($this->email != '') {
return array('ROLE_ADMIN');
} else {
return array('ROLE_USER');
}
}
public function setRoles(array $roles): self
{
$this->roles = $roles;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
}
/**
* @see \Serializable::serialize()
*/
public function serialize()
{
return serialize(array(
$this->id,
$this->email,
$this->password,
// see section on salt below
// $this->salt,
));
}
/**
* @see \Serializable::unserialize()
*/
public function unserialize($serialized)
{
list (
$this->id,
$this->email,
$this->password,
// see section on salt below
// $this->salt
) = unserialize($serialized);
}
public function isAccountNonExpired()
{
return true;
}
public function isAccountNonLocked()
{
return true;
}
public function isCredentialsNonExpired()
{
return true;
}
public function isEnabled()
{
return $this->getActivat();
}
/**
* Set Idioma
*
* @param \App\Entity\Idioma $idioma
* @return Usuari
*/
public function setIdioma(\App\Entity\Idioma $idioma): self
{
$this->idioma = $idioma;
return $this;
}
/**
* Get idioma
*
* @return string
*/
public function getIdioma()
{
return $this->idioma;
}
/**
* Set Perfils
*
* @param \App\Entity\Perfils $perfils
* @return Usuari
*/
public function setPerfils(\App\Entity\Perfils $perfils)
{
$this->perfils = $perfils;
return $this;
}
/**
* Get perfils
*
* @return string
*/
public function getPerfils()
{
return $this->perfils;
}
/**
* Set direccio
*
* @param string $direccio
* @return Usuari
*/
public function setDireccio(string $direccio): self
{
$this->direccio = $direccio;
return $this;
}
/**
* Get direccio
*
* @return string
*/
public function getDireccio()
{
return $this->direccio;
}
/**
* Set cp
*
* @param string $cp
* @return Usuari
*/
public function setCp(string $cp): self
{
$this->cp = $cp;
return $this;
}
/**
* Get cp
*
* @return string
*/
public function getCp()
{
return $this->cp;
}
/**
* Set poblacio
*
* @param string $poblacio
* @return Usuari
*/
public function setPoblacio(string $poblacio): self
{
$this->poblacio = $poblacio;
return $this;
}
/**
* Get poblacio
*
* @return string
*/
public function getPoblacio()
{
return $this->poblacio;
}
/**
* Set telefon
*
* @param string $telefon
* @return Usuari
*/
public function setTelefon(string $telefon): self
{
$this->telefon = $telefon;
return $this;
}
/**
* Get telefon
*
* @return string
*/
public function getTelefon()
{
return $this->telefon;
}
/**
* Set responsable
*
* @param string $responsable
* @return Usuari
*/
public function setResponsable(string $responsable): self
{
$this->responsable = $responsable;
return $this;
}
/**
* Get responsable
*
* @return string
*/
public function getResponsable()
{
return $this->responsable;
}
/**
* Set codi
*
* @param string $codi
* @return Usuari
*/
public function setCodi(string $codi): self
{
$this->codi = $codi;
return $this;
}
/**
* Get codi
*
* @return string
*/
public function getCodi()
{
return $this->codi;
}
/**
* Set clubEsqui
*
* @param boolean $clubEsqui
* @return Usuari
*/
public function setClubEsqui($clubEsqui)
{
$this->clubEsqui = $clubEsqui;
return $this;
}
/**
* Get clubEsqui
*
* @return boolean
*/
public function getClubEsqui()
{
return $this->clubEsqui;
}
/**
* Set cadaQuantsGratuit
*
* @param integer $cadaQuantsGratuit
* @return Usuari
*/
public function setCadaQuantsGratuit($cadaQuantsGratuit): self
{
$this->cadaQuantsGratuit = $cadaQuantsGratuit;
return $this;
}
/**
* Get cadaQuantsGratuit
*
* @return integer
*/
public function getCadaQuantsGratuit()
{
return $this->cadaQuantsGratuit;
}
/**
* Set quantsGratuitFets
*
* @param integer $quantsGratuitFets
* @return Usuari
*/
public function setQuantsGratuitFets($quantsGratuitFets): self
{
$this->quantsGratuitFets = $quantsGratuitFets;
return $this;
}
/**
* Get quantsGratuitFets
*
* @return integer
*/
public function getQuantsGratuitFets()
{
return $this->quantsGratuitFets;
}
/**
* Set cadaQuantsGratuitAlp
*
* @param integer $cadaQuantsGratuitAlp
* @return Usuari
*/
public function setCadaQuantsGratuitAlp($cadaQuantsGratuitAlp): self
{
$this->cadaQuantsGratuitAlp = $cadaQuantsGratuitAlp;
return $this;
}
/**
* Get cadaQuantsGratuitAlp
*
* @return integer
*/
public function getCadaQuantsGratuitAlp()
{
return $this->cadaQuantsGratuitAlp;
}
/**
* Set quantsGratuitFetsAlp
*
* @param integer $quantsGratuitFetsAlp
* @return Usuari
*/
public function setQuantsGratuitFetsAlp($quantsGratuitFetsAlp): self
{
$this->quantsGratuitFetsAlp = $quantsGratuitFetsAlp;
return $this;
}
/**
* Get quantsGratuitFetsAlp
*
* @return integer
*/
public function getQuantsGratuitFetsAlp()
{
return $this->quantsGratuitFetsAlp;
}
/**
* The public representation of the user (e.g. a username, an email address, etc.)
*
* @see UserInterface
*/
public function getUserIdentifier(): string
{
return (string) $this->email;
}
/**
* Set clubs1
*
* @param boolean $clubs1
* @return Usuari
*/
public function setClubs1($clubs1): self
{
$this->clubs1 = $clubs1;
return $this;
}
/**
* Get clubs1
*
* @return boolean
*/
public function getClubs1()
{
return $this->clubs1;
}
/**
* Set clubs2
*
* @param boolean $clubs2
* @return Usuari
*/
public function setClubs2($clubs2): self
{
$this->clubs2 = $clubs2;
return $this;
}
/**
* Get clubs2
*
* @return boolean
*/
public function getClubs2()
{
return $this->clubs2;
}
/**
* Set clubs3
*
* @param boolean $clubs3
* @return Usuari
*/
public function setClubs3($clubs3): self
{
$this->clubs3 = $clubs3;
return $this;
}
/**
* Get clubs3
*
* @return boolean
*/
public function getClubs3()
{
return $this->clubs3;
}
/**
* Set clubs4
*
* @param boolean $clubs4
* @return Usuari
*/
public function setClubs4($clubs4): self
{
$this->clubs4 = $clubs4;
return $this;
}
/**
* Get clubs4
*
* @return boolean
*/
public function getClubs4()
{
return $this->clubs4;
}
/**
* Set llocCentral
*
* @param boolean $llocCentral
* @return Usuari
*/
public function setLlocCentral($llocCentral): self
{
$this->llocCentral = $llocCentral;
return $this;
}
/**
* Get llocCentral
*
* @return boolean
*/
public function getLlocCentral()
{
return $this->llocCentral;
}
/**
* Set llocFira
*
* @param boolean $llocFira
* @return Usuari
*/
public function setLlocFira($llocFira): self
{
$this->llocFira = $llocFira;
return $this;
}
/**
* Get llocFira
*
* @return boolean
*/
public function getLlocFira()
{
return $this->llocFira;
}
/**
* Set llocOficina
*
* @param boolean $llocOficina
* @return Usuari
*/
public function setLlocOficina($llocOficina): self
{
$this->llocOficina = $llocOficina;
return $this;
}
/**
* Get llocOficina
*
* @return boolean
*/
public function getLlocOficina()
{
return $this->llocOficina;
}
/**
* Set llocClubs
*
* @param boolean $llocClubs
* @return Usuari
*/
public function setLlocClubs($llocClubs): self
{
$this->llocClubs = $llocClubs;
return $this;
}
/**
* Get llocClubs
*
* @return boolean
*/
public function getLlocClubs()
{
return $this->llocClubs;
}
/**
* Set llocWeb
*
* @param boolean $llocWeb
* @return Usuari
*/
public function setLlocWeb($llocWeb): self
{
$this->llocWeb = $llocWeb;
return $this;
}
/**
* Get llocWeb
*
* @return boolean
*/
public function getLlocWeb()
{
return $this->llocWeb;
}
}