<?php
namespace App\Security\Entity;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use JetBrains\PhpStorm\Pure;
use Serializable;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
use Symfony\Component\Uid\Uuid;
/**
* @ORM\Table(name="app_security_user")
* @ORM\Entity(repositoryClass="App\Security\Repository\UserRepository")
*/
class User implements UserInterface, Serializable, PasswordAuthenticatedUserInterface
{
/**
* @ORM\Column(type="integer")
* @ORM\Id
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected int $id;
/**
* @ORM\Column(type="uuid", nullable=true)
*/
protected string $uuid;
/**
* @ORM\Column(type="string", length=128, unique=true)
*/
protected string $username;
/**
* @ORM\Column(type="string", length=64)
*/
protected string $password;
/**
* @ORM\Column(type="string", length=254, unique=true, nullable=true)
*/
protected ?string $email;
/**
* @var bool|null
* @ORM\Column(type="boolean", nullable=true)
*/
protected ?bool $receiveMonitorResultEmail;
/**
* @var bool|null
* @ORM\Column(type="boolean", nullable=true)
*/
protected ?bool $sendOnlyErrors;
/**
* @var string|null
* @ORM\Column(type="string", nullable=true)
*/
protected ?string $environmentNotificationLevel;
/**
* @var Token[]
* @ORM\OneToMany(targetEntity="App\Security\Entity\Token", mappedBy="user", fetch="EXTRA_LAZY")
*/
protected array|Collection $tokens;
/**
* @ORM\Column(name="is_active", type="boolean")
*/
protected bool $isActive;
/**
* @var string|null
* @ORM\Column(nullable=true)
*/
protected ?string $name;
/**
* @var string|null
* @ORM\Column(nullable=true)
*/
protected ?string $surname;
public function __construct()
{
$this->uuid = Uuid::v4();
$this->isActive = true;
$this->name = null;
$this->surname = null;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @return Collection|array
*/
public function getTokens(): Collection|array
{
return $this->tokens;
}
/**
* @param Token[] $tokens
* @return User
*/
public function setTokens(Collection|array $tokens): User
{
$this->tokens = $tokens;
return $this;
}
/**
* @return string|null
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param string $name
* @return User
*/
public function setName(string $name): User
{
$this->name = $name;
return $this;
}
/**
* @return string|null
*/
public function getSurname(): ?string
{
return $this->surname;
}
/**
* @param string $surname
* @return User
*/
public function setSurname(string $surname): User
{
$this->surname = $surname;
return $this;
}
public function getUsername(): string
{
return $this->username;
}
/**
* @param string $username
* @return User
*/
public function setUsername(string $username): User
{
$this->username = $username;
return $this;
}
/**
* @return string
*/
public function getUuid(): string
{
return $this->uuid;
}
/**
* @param string $uuid
* @return User
*/
public function setUuid(string $uuid): User
{
$this->uuid = $uuid;
return $this;
}
/**
* @return string|null
*/
public function getEmail(): ?string
{
return $this->email;
}
/**
* @param string $email
* @return User
*/
public function setEmail(string $email): User
{
$this->email = $email;
return $this;
}
/**
* @return string|null
*/
public function getPassword(): ?string
{
return $this->password;
}
/**
* @param string $password
* @return User
*/
public function setRawPassword(string $password): User
{
$this->password = $password;
return $this;
}
/**
* @return string[]
*/
public function getRoles(): array
{
return array('ROLE_USER');
}
public function eraseCredentials()
{
}
/** @see \Serializable::serialize() */
public function serialize(): ?string
{
return serialize(array(
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt,
));
}
/** @see \Serializable::unserialize() */
public function unserialize($data): void
{
list (
$this->id,
$this->username,
$this->password,
// see section on salt below
// $this->salt
) = unserialize($data, array('allowed_classes' => false));
}
public function getPhoneNumber(): ?string
{
// TODO: Implement getPhoneNumber() method.
return null;
}
public function getUser(): ?User
{
return $this;
}
#[Pure] public function getUserIdentifier(): string
{
return $this->getUsername();
}
/**
* @return bool|null
*/
public function getReceiveMonitorResultEmail(): ?bool
{
return $this->receiveMonitorResultEmail;
}
/**
* @param bool|null $receiveMonitorResultEmail
*/
public function setReceiveMonitorResultEmail(?bool $receiveMonitorResultEmail): void
{
$this->receiveMonitorResultEmail = $receiveMonitorResultEmail;
}
public function getSendOnlyErrors(): ?bool
{
return $this->sendOnlyErrors;
}
public function setSendOnlyErrors(?bool $sendOnlyErrors): void
{
$this->sendOnlyErrors = $sendOnlyErrors;
}
public function isActive(): bool
{
return $this->isActive;
}
public function setIsActive(bool $isActive): void
{
$this->isActive = $isActive;
}
public function getEnvironmentNotificationLevel(): ?string
{
return $this->environmentNotificationLevel;
}
public function setEnvironmentNotificationLevel(?string $environmentNotificationLevel): void
{
$this->environmentNotificationLevel = $environmentNotificationLevel;
}
}