<?php
namespace App\Entity;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Security\Core\User\EquatableInterface;
/**
* @ORM\Entity(repositoryClass="App\Repository\UserRepository")
* @ORM\Table(name="mmpp_user")
* @method string getUserIdentifier()
*/
class User implements UserInterface, \Serializable
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* @ORM\Column(type="string", length=60, unique=true)
*/
protected $username;
/**
* @ORM\Column(type="string", length=32)
*/
protected $salt;
/**
* @ORM\Column(type="string", length=40)
*/
protected $password;
/**
* @ORM\Column(type="string", length=60, unique=true)
*/
protected $email;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
protected $isActive;
/**
* @ORM\OneToMany(targetEntity="Tarif", mappedBy="user")
*/
protected $tarifs;
/**
* @ORM\OneToMany(targetEntity="Document", mappedBy="user")
*/
protected $documents;
/**
* @ORM\OneToMany(targetEntity="InscriptionFile", mappedBy="user")
*/
protected $files;
public function __construct()
{
$this->tarifs = new ArrayCollection();
$this->documents = new ArrayCollection();
$this->files = new ArrayCollection();
}
/**
* @inheritDoc
*/
public function getRoles()
{
return array('ROLE_USER');
}
/**
* @inheritDoc
*/
public function eraseCredentials()
{
}
/**
* @inheritDoc
*/
public function isEqualTo(UserInterface $user)
{
return $this->username === $user->getUsername();
}
public function isAccountNonExpired()
{
return true;
}
public function isAccountNonLocked()
{
return true;
}
public function isCredentialsNonExpired()
{
return true;
}
public function isEnabled()
{
return $this->isActive;
}
/**
* @see \Serializable::serialize()
*/
public function serialize()
{
return serialize(array(
$this->id,
));
}
/**
* @see \Serializable::unserialize()
*/
public function unserialize($serialized)
{
list (
$this->id,
) = unserialize($serialized);
}
public function __call(string $name, array $arguments)
{
// TODO: Implement @method string getUserIdentifier()
}
public function getId(): ?int
{
return $this->id;
}
public function getUsername()
{
return $this->username;
}
public function setUsername($username)
{
$this->username = $username;
return $this;
}
public function getSalt()
{
return $this->salt;
}
public function setSalt($salt)
{
$this->salt = $salt;
return $this;
}
public function getPassword()
{
return $this->password;
}
public function setPassword($password)
{
$this->password = $password;
return $this;
}
public function getEmail(): ?string
{
return $this->email;
}
public function setEmail(string $email): self
{
$this->email = $email;
return $this;
}
public function setIsActive(bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
/**
* @return Collection<int, Tarif>
*/
public function getTarifs(): Collection
{
return $this->tarifs;
}
public function addTarif(Tarif $tarif): self
{
if (!$this->tarifs->contains($tarif)) {
$this->tarifs->add($tarif);
$tarif->setUser($this);
}
return $this;
}
public function removeTarif(Tarif $tarif): self
{
if ($this->tarifs->removeElement($tarif)) {
// set the owning side to null (unless already changed)
if ($tarif->getUser() === $this) {
$tarif->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, Document>
*/
public function getDocuments(): Collection
{
return $this->documents;
}
public function addDocument(Document $document): self
{
if (!$this->documents->contains($document)) {
$this->documents->add($document);
$document->setUser($this);
}
return $this;
}
public function removeDocument(Document $document): self
{
if ($this->documents->removeElement($document)) {
// set the owning side to null (unless already changed)
if ($document->getUser() === $this) {
$document->setUser(null);
}
}
return $this;
}
/**
* @return Collection<int, InscriptionFile>
*/
public function getFiles(): Collection
{
return $this->files;
}
public function addFile(InscriptionFile $file): self
{
if (!$this->files->contains($file)) {
$this->files->add($file);
$file->setUser($this);
}
return $this;
}
public function removeFile(InscriptionFile $file): self
{
if ($this->files->removeElement($file)) {
// set the owning side to null (unless already changed)
if ($file->getUser() === $this) {
$file->setUser(null);
}
}
return $this;
}
public function isIsActive(): ?bool
{
return $this->isActive;
}
}