src/Entity/User.php line 16
<?php
namespace App\Entity;
use App\Repository\UserRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 180, unique: true)]
private ?string $email;
#[ORM\Column(type: 'json')]
private array $roles = [];
#[ORM\Column(type: 'string')]
private string $password;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: InventoryEquipment::class, orphanRemoval: true)]
private Collection $inventoryEquipment;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: InventoryCatchable::class, orphanRemoval: true)]
private Collection $inventoryCatchables;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $gameToken;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserGear::class)]
private Collection $userGears;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $wallet;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: UserRecord::class, orphanRemoval: true)]
private Collection $userRecords;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $googleId;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: InventoryMaterial::class, orphanRemoval: true)]
private Collection $inventoryMaterials;
// #[ORM\OneToOne(mappedBy: 'user', targetEntity: NftQueue::class, cascade: ['persist', 'remove'])]
// private ?NftQueue $nftQueue;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: SalvageQueue::class, orphanRemoval: true)]
private Collection $salvageQueues;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
private ?string $username;
#[ORM\Column(type: 'integer', nullable: true)]
private ?int $walletExtension;
#[ORM\Column(type: 'json', nullable: true)]
private array|null $config = [];
#[ORM\OneToOne(inversedBy: 'user', targetEntity: ThetaWallet::class, cascade: ['persist', 'remove'])]
private ?ThetaWallet $activeWallet;
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $lastRecipeHint = null;
#[ORM\OneToOne(inversedBy: 'user', cascade: ['persist', 'remove'])]
private ?CatchableQueue $catchableQueue = null;
#[ORM\Column(type: Types::DECIMAL, precision: 12, scale: '0', nullable: true)]
private ?string $experience = '0';
#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]
private ?\DateTimeInterface $shadowBanUntil = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: ShopItemPurchases::class, orphanRemoval: true)]
private Collection $shopItemPurchases;
#[ORM\Column(nullable: true)]
private ?int $shinies = 0;
#[ORM\ManyToMany(targetEntity: Recipe::class, inversedBy: 'users', cascade: ['persist'])]
private Collection $unlockedRecipes;
#[ORM\Column(length: 255, nullable: true)]
private ?string $gameToken2 = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?ActProgression $actProgression = null;
#[ORM\OneToOne(cascade: ['persist', 'remove'])]
private ?ThetaWallet $thetaDropWallet = null;
public function __construct()
{
$this->userGears = new ArrayCollection();
$this->inventoryEquipment = new ArrayCollection();
$this->inventoryCatchables = new ArrayCollection();
$this->userGears = new ArrayCollection();
$this->userRecords = new ArrayCollection();
$this->inventoryMaterials = new ArrayCollection();
$this->salvageQueues = new ArrayCollection();
$this->shopItemPurchases = new ArrayCollection();
$this->unlockedRecipes = 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->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;
}
/**
* @return Collection|InventoryEquipment[]
*/
public function getInventoryEquipment(): Collection
{
return $this->inventoryEquipment;
}
public function addInventoryEquipment(InventoryEquipment $inventoryEquipment): self
{
if (!$this->inventoryEquipment->contains($inventoryEquipment)) {
$this->inventoryEquipment[] = $inventoryEquipment;
$inventoryEquipment->setUser($this);
}
return $this;
}
public function removeInventoryEquipment(InventoryEquipment $inventoryEquipment): self
{
if ($this->inventoryEquipment->removeElement($inventoryEquipment)) {
// set the owning side to null (unless already changed)
if ($inventoryEquipment->getUser() === $this) {
$inventoryEquipment->setUser(null);
}
}
return $this;
}
/**
* @return Collection|InventoryCatchable[]
*/
public function getInventoryCatchables(): Collection
{
return $this->inventoryCatchables;
}
public function addInventoryCatchable(InventoryCatchable $inventoryCatchable): self
{
if (!$this->inventoryCatchables->contains($inventoryCatchable)) {
$this->inventoryCatchables[] = $inventoryCatchable;
$inventoryCatchable->setUser($this);
}
return $this;
}
public function removeInventoryCatchable(InventoryCatchable $inventoryCatchable): self
{
if ($this->inventoryCatchables->removeElement($inventoryCatchable)) {
// set the owning side to null (unless already changed)
if ($inventoryCatchable->getUser() === $this) {
$inventoryCatchable->setUser(null);
}
}
return $this;
}
public function getGameToken(): ?string
{
return $this->gameToken;
}
public function setGameToken(?string $gameToken): self
{
$this->gameToken = $gameToken;
return $this;
}
/**
* @return Collection|UserGear[]
*/
public function getUserGears(): Collection
{
return $this->userGears;
}
public function addUserGear(UserGear $userGear): self
{
if (!$this->userGears->contains($userGear)) {
$this->userGears[] = $userGear;
$userGear->setUser($this);
}
return $this;
}
public function removeUserGear(UserGear $userGear): self
{
if ($this->userGears->removeElement($userGear)) {
// set the owning side to null (unless already changed)
if ($userGear->getUser() === $this) {
$userGear->setUser(null);
}
}
return $this;
}
public function getWallet(): ?string
{
return $this->wallet;
}
public function setWallet(?string $wallet): self
{
$this->wallet = $wallet;
return $this;
}
/**
* @return Collection|UserRecord[]
*/
public function getUserRecords(): Collection
{
return $this->userRecords;
}
public function addUserRecord(UserRecord $userRecord): self
{
if (!$this->userRecords->contains($userRecord)) {
$this->userRecords[] = $userRecord;
$userRecord->setUser($this);
}
return $this;
}
public function removeUserRecord(UserRecord $userRecord): self
{
if ($this->userRecords->removeElement($userRecord)) {
// set the owning side to null (unless already changed)
if ($userRecord->getUser() === $this) {
$userRecord->setUser(null);
}
}
return $this;
}
public function getGoogleId(): ?string
{
return $this->googleId;
}
public function setGoogleId(?string $googleId): self
{
$this->googleId = $googleId;
return $this;
}
/**
* @return Collection|InventoryMaterial[]
*/
public function getInventoryMaterials(): Collection
{
return $this->inventoryMaterials;
}
public function addInventoryMaterial(InventoryMaterial $inventoryMaterial): self
{
if (!$this->inventoryMaterials->contains($inventoryMaterial)) {
$this->inventoryMaterials[] = $inventoryMaterial;
$inventoryMaterial->setUser($this);
}
return $this;
}
public function removeInventoryMaterial(InventoryMaterial $inventoryMaterial): self
{
if ($this->inventoryMaterials->removeElement($inventoryMaterial)) {
// set the owning side to null (unless already changed)
if ($inventoryMaterial->getUser() === $this) {
$inventoryMaterial->setUser(null);
}
}
return $this;
}
// public function getNftQueue(): ?NftQueue
// {
// return $this->nftQueue;
// }
//
// public function setNftQueue(NftQueue $nftQueue): self
// {
// // set the owning side of the relation if necessary
// if ($nftQueue->getUser() !== $this) {
// $nftQueue->setUser($this);
// }
//
// $this->nftQueue = $nftQueue;
//
// return $this;
// }
/**
* @return Collection|SalvageQueue[]
*/
public function getSalvageQueues(): Collection
{
return $this->salvageQueues;
}
public function addSalvageQueue(SalvageQueue $salvageQueue): self
{
if (!$this->salvageQueues->contains($salvageQueue)) {
$this->salvageQueues[] = $salvageQueue;
$salvageQueue->setUser($this);
}
return $this;
}
public function removeSalvageQueue(SalvageQueue $salvageQueue): self
{
if ($this->salvageQueues->removeElement($salvageQueue)) {
// set the owning side to null (unless already changed)
if ($salvageQueue->getUser() === $this) {
$salvageQueue->setUser(null);
}
}
return $this;
}
public function setUsername(?string $username): self
{
$this->username = $username;
return $this;
}
public function getWalletExtension(): ?int
{
return $this->walletExtension;
}
public function setWalletExtension(?int $walletExtension): self
{
$this->walletExtension = $walletExtension;
return $this;
}
public function getConfig(): ?array
{
return $this->config;
}
public function setConfig(?array $config): self
{
$this->config = $config;
return $this;
}
public function getActiveWallet(): ?ThetaWallet
{
return $this->activeWallet;
}
public function setActiveWallet(?ThetaWallet $activeWallet): self
{
$this->activeWallet = $activeWallet;
return $this;
}
public function getLastRecipeHint(): ?\DateTimeInterface
{
return $this->lastRecipeHint;
}
public function setLastRecipeHint(?\DateTimeInterface $lastRecipeHint): self
{
$this->lastRecipeHint = $lastRecipeHint;
return $this;
}
public function getCatchableQueue(): ?CatchableQueue
{
return $this->catchableQueue;
}
public function setCatchableQueue(CatchableQueue $catchableQueue): self
{
// set the owning side of the relation if necessary
if ($catchableQueue->getUser() !== $this) {
$catchableQueue->setUser($this);
}
$this->catchableQueue = $catchableQueue;
return $this;
}
public function getExperience(): ?string
{
return $this->experience;
}
public function setExperience(?string $experience): self
{
$this->experience = $experience;
return $this;
}
public function getShadowBanUntil(): ?\DateTimeInterface
{
return $this->shadowBanUntil;
}
public function setShadowBanUntil(?\DateTimeInterface $shadowBanUntil): self
{
$this->shadowBanUntil = $shadowBanUntil;
return $this;
}
/**
* @return Collection<int, ShopItemPurchases>
*/
public function getShopItemPurchases(): Collection
{
return $this->shopItemPurchases;
}
public function addShopItemPurchase(ShopItemPurchases $shopItemPurchase): self
{
if (!$this->shopItemPurchases->contains($shopItemPurchase)) {
$this->shopItemPurchases->add($shopItemPurchase);
$shopItemPurchase->setUser($this);
}
return $this;
}
public function removeShopItemPurchase(ShopItemPurchases $shopItemPurchase): self
{
if ($this->shopItemPurchases->removeElement($shopItemPurchase)) {
// set the owning side to null (unless already changed)
if ($shopItemPurchase->getUser() === $this) {
$shopItemPurchase->setUser(null);
}
}
return $this;
}
public function getShinies(): ?int
{
return $this->shinies;
}
public function setShinies(?int $shinies): self
{
$this->shinies = $shinies;
return $this;
}
/**
* @return Collection<int, Recipe>
*/
public function getUnlockedRecipes(): Collection
{
return $this->unlockedRecipes;
}
public function addUnlockedRecipe(Recipe $unlockedRecipe): self
{
if (!$this->unlockedRecipes->contains($unlockedRecipe)) {
$this->unlockedRecipes->add($unlockedRecipe);
}
return $this;
}
public function removeUnlockedRecipe(Recipe $unlockedRecipe): self
{
$this->unlockedRecipes->removeElement($unlockedRecipe);
return $this;
}
public function getGameToken2(): ?string
{
return $this->gameToken2;
}
public function setGameToken2(?string $gameToken2): self
{
$this->gameToken2 = $gameToken2;
return $this;
}
public function getActProgression(): ?ActProgression
{
return $this->actProgression;
}
public function setActProgression(?ActProgression $actProgression): self
{
$this->actProgression = $actProgression;
return $this;
}
public function getThetaDropWallet(): ?ThetaWallet
{
return $this->thetaDropWallet;
}
public function setThetaDropWallet(?ThetaWallet $thetaDropWallet): self
{
$this->thetaDropWallet = $thetaDropWallet;
return $this;
}
}