src/Entity/User.php line 16

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\UserRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  9. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  10. use Symfony\Component\Security\Core\User\UserInterface;
  11. #[ORM\Entity(repositoryClassUserRepository::class)]
  12. #[UniqueEntity(fields: ['email'], message'There is already an account with this email')]
  13. class User implements UserInterfacePasswordAuthenticatedUserInterface
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private $id;
  19.     #[ORM\Column(type'string'length180uniquetrue)]
  20.     private ?string $email;
  21.     #[ORM\Column(type'json')]
  22.     private array $roles = [];
  23.     #[ORM\Column(type'string')]
  24.     private string $password;
  25.     #[ORM\OneToMany(mappedBy'user'targetEntityInventoryEquipment::class, orphanRemovaltrue)]
  26.     private Collection $inventoryEquipment;
  27.     #[ORM\OneToMany(mappedBy'user'targetEntityInventoryCatchable::class, orphanRemovaltrue)]
  28.     private Collection $inventoryCatchables;
  29.     #[ORM\Column(type'string'length255nullabletrue)]
  30.     private ?string $gameToken;
  31.     #[ORM\OneToMany(mappedBy'user'targetEntityUserGear::class)]
  32.     private Collection $userGears;
  33.     #[ORM\Column(type'string'length255nullabletrue)]
  34.     private ?string $wallet;
  35.     #[ORM\OneToMany(mappedBy'user'targetEntityUserRecord::class, orphanRemovaltrue)]
  36.     private Collection $userRecords;
  37.     #[ORM\Column(type'string'length255nullabletrue)]
  38.     private ?string $googleId;
  39.     #[ORM\OneToMany(mappedBy'user'targetEntityInventoryMaterial::class, orphanRemovaltrue)]
  40.     private Collection $inventoryMaterials;
  41. //    #[ORM\OneToOne(mappedBy: 'user', targetEntity: NftQueue::class, cascade: ['persist', 'remove'])]
  42. //    private ?NftQueue $nftQueue;
  43.     #[ORM\OneToMany(mappedBy'user'targetEntitySalvageQueue::class, orphanRemovaltrue)]
  44.     private Collection $salvageQueues;
  45.     #[ORM\Column(type'string'length255nullabletrue)]
  46.     private ?string $username;
  47.     #[ORM\Column(type'integer'nullabletrue)]
  48.     private ?int $walletExtension;
  49.     #[ORM\Column(type'json'nullabletrue)]
  50.     private array|null $config = [];
  51.     #[ORM\OneToOne(inversedBy'user'targetEntityThetaWallet::class, cascade: ['persist''remove'])]
  52.     private ?ThetaWallet $activeWallet;
  53.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  54.     private ?\DateTimeInterface $lastRecipeHint null;
  55.     #[ORM\OneToOne(inversedBy'user'cascade: ['persist''remove'])]
  56.     private ?CatchableQueue $catchableQueue null;
  57.     #[ORM\Column(typeTypes::DECIMALprecision12scale'0'nullabletrue)]
  58.     private ?string $experience '0';
  59.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  60.     private ?\DateTimeInterface $shadowBanUntil null;
  61.     #[ORM\OneToMany(mappedBy'user'targetEntityShopItemPurchases::class, orphanRemovaltrue)]
  62.     private Collection $shopItemPurchases;
  63.     #[ORM\Column(nullabletrue)]
  64.     private ?int $shinies 0;
  65.     #[ORM\ManyToMany(targetEntityRecipe::class, inversedBy'users'cascade: ['persist'])]
  66.     private Collection $unlockedRecipes;
  67.     #[ORM\Column(length255nullabletrue)]
  68.     private ?string $gameToken2 null;
  69.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  70.     private ?ActProgression $actProgression null;
  71.     #[ORM\OneToOne(cascade: ['persist''remove'])]
  72.     private ?ThetaWallet $thetaDropWallet null;
  73.     public function __construct()
  74.     {
  75.         $this->userGears = new ArrayCollection();
  76.         $this->inventoryEquipment = new ArrayCollection();
  77.         $this->inventoryCatchables = new ArrayCollection();
  78.         $this->userGears = new ArrayCollection();
  79.         $this->userRecords = new ArrayCollection();
  80.         $this->inventoryMaterials = new ArrayCollection();
  81.         $this->salvageQueues = new ArrayCollection();
  82.         $this->shopItemPurchases = new ArrayCollection();
  83.         $this->unlockedRecipes = new ArrayCollection();
  84.     }
  85.     public function getId(): ?int
  86.     {
  87.         return $this->id;
  88.     }
  89.     public function getEmail(): ?string
  90.     {
  91.         return $this->email;
  92.     }
  93.     public function setEmail(string $email): self
  94.     {
  95.         $this->email $email;
  96.         return $this;
  97.     }
  98.     /**
  99.      * A visual identifier that represents this user.
  100.      *
  101.      * @see UserInterface
  102.      */
  103.     public function getUserIdentifier(): string
  104.     {
  105.         return (string) $this->email;
  106.     }
  107.     /**
  108.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  109.      */
  110.     public function getUsername(): string
  111.     {
  112.         return (string) $this->username;
  113.     }
  114.     /**
  115.      * @see UserInterface
  116.      */
  117.     public function getRoles(): array
  118.     {
  119.         $roles $this->roles;
  120.         // guarantee every user at least has ROLE_USER
  121.         $roles[] = 'ROLE_USER';
  122.         return array_unique($roles);
  123.     }
  124.     public function setRoles(array $roles): self
  125.     {
  126.         $this->roles $roles;
  127.         return $this;
  128.     }
  129.     /**
  130.      * @see PasswordAuthenticatedUserInterface
  131.      */
  132.     public function getPassword(): string
  133.     {
  134.         return $this->password;
  135.     }
  136.     public function setPassword(string $password): self
  137.     {
  138.         $this->password $password;
  139.         return $this;
  140.     }
  141.     /**
  142.      * Returning a salt is only needed, if you are not using a modern
  143.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  144.      *
  145.      * @see UserInterface
  146.      */
  147.     public function getSalt(): ?string
  148.     {
  149.         return null;
  150.     }
  151.     /**
  152.      * @see UserInterface
  153.      */
  154.     public function eraseCredentials()
  155.     {
  156.         // If you store any temporary, sensitive data on the user, clear it here
  157.         // $this->plainPassword = null;
  158.     }
  159.     /**
  160.      * @return Collection|InventoryEquipment[]
  161.      */
  162.     public function getInventoryEquipment(): Collection
  163.     {
  164.         return $this->inventoryEquipment;
  165.     }
  166.     public function addInventoryEquipment(InventoryEquipment $inventoryEquipment): self
  167.     {
  168.         if (!$this->inventoryEquipment->contains($inventoryEquipment)) {
  169.             $this->inventoryEquipment[] = $inventoryEquipment;
  170.             $inventoryEquipment->setUser($this);
  171.         }
  172.         return $this;
  173.     }
  174.     public function removeInventoryEquipment(InventoryEquipment $inventoryEquipment): self
  175.     {
  176.         if ($this->inventoryEquipment->removeElement($inventoryEquipment)) {
  177.             // set the owning side to null (unless already changed)
  178.             if ($inventoryEquipment->getUser() === $this) {
  179.                 $inventoryEquipment->setUser(null);
  180.             }
  181.         }
  182.         return $this;
  183.     }
  184.     /**
  185.      * @return Collection|InventoryCatchable[]
  186.      */
  187.     public function getInventoryCatchables(): Collection
  188.     {
  189.         return $this->inventoryCatchables;
  190.     }
  191.     public function addInventoryCatchable(InventoryCatchable $inventoryCatchable): self
  192.     {
  193.         if (!$this->inventoryCatchables->contains($inventoryCatchable)) {
  194.             $this->inventoryCatchables[] = $inventoryCatchable;
  195.             $inventoryCatchable->setUser($this);
  196.         }
  197.         return $this;
  198.     }
  199.     public function removeInventoryCatchable(InventoryCatchable $inventoryCatchable): self
  200.     {
  201.         if ($this->inventoryCatchables->removeElement($inventoryCatchable)) {
  202.             // set the owning side to null (unless already changed)
  203.             if ($inventoryCatchable->getUser() === $this) {
  204.                 $inventoryCatchable->setUser(null);
  205.             }
  206.         }
  207.         return $this;
  208.     }
  209.     public function getGameToken(): ?string
  210.     {
  211.         return $this->gameToken;
  212.     }
  213.     public function setGameToken(?string $gameToken): self
  214.     {
  215.         $this->gameToken $gameToken;
  216.         return $this;
  217.     }
  218.     /**
  219.      * @return Collection|UserGear[]
  220.      */
  221.     public function getUserGears(): Collection
  222.     {
  223.         return $this->userGears;
  224.     }
  225.     public function addUserGear(UserGear $userGear): self
  226.     {
  227.         if (!$this->userGears->contains($userGear)) {
  228.             $this->userGears[] = $userGear;
  229.             $userGear->setUser($this);
  230.         }
  231.         return $this;
  232.     }
  233.     public function removeUserGear(UserGear $userGear): self
  234.     {
  235.         if ($this->userGears->removeElement($userGear)) {
  236.             // set the owning side to null (unless already changed)
  237.             if ($userGear->getUser() === $this) {
  238.                 $userGear->setUser(null);
  239.             }
  240.         }
  241.         return $this;
  242.     }
  243.     public function getWallet(): ?string
  244.     {
  245.         return $this->wallet;
  246.     }
  247.     public function setWallet(?string $wallet): self
  248.     {
  249.         $this->wallet $wallet;
  250.         return $this;
  251.     }
  252.     /**
  253.      * @return Collection|UserRecord[]
  254.      */
  255.     public function getUserRecords(): Collection
  256.     {
  257.         return $this->userRecords;
  258.     }
  259.     public function addUserRecord(UserRecord $userRecord): self
  260.     {
  261.         if (!$this->userRecords->contains($userRecord)) {
  262.             $this->userRecords[] = $userRecord;
  263.             $userRecord->setUser($this);
  264.         }
  265.         return $this;
  266.     }
  267.     public function removeUserRecord(UserRecord $userRecord): self
  268.     {
  269.         if ($this->userRecords->removeElement($userRecord)) {
  270.             // set the owning side to null (unless already changed)
  271.             if ($userRecord->getUser() === $this) {
  272.                 $userRecord->setUser(null);
  273.             }
  274.         }
  275.         return $this;
  276.     }
  277.     public function getGoogleId(): ?string
  278.     {
  279.         return $this->googleId;
  280.     }
  281.     public function setGoogleId(?string $googleId): self
  282.     {
  283.         $this->googleId $googleId;
  284.         return $this;
  285.     }
  286.     /**
  287.      * @return Collection|InventoryMaterial[]
  288.      */
  289.     public function getInventoryMaterials(): Collection
  290.     {
  291.         return $this->inventoryMaterials;
  292.     }
  293.     public function addInventoryMaterial(InventoryMaterial $inventoryMaterial): self
  294.     {
  295.         if (!$this->inventoryMaterials->contains($inventoryMaterial)) {
  296.             $this->inventoryMaterials[] = $inventoryMaterial;
  297.             $inventoryMaterial->setUser($this);
  298.         }
  299.         return $this;
  300.     }
  301.     public function removeInventoryMaterial(InventoryMaterial $inventoryMaterial): self
  302.     {
  303.         if ($this->inventoryMaterials->removeElement($inventoryMaterial)) {
  304.             // set the owning side to null (unless already changed)
  305.             if ($inventoryMaterial->getUser() === $this) {
  306.                 $inventoryMaterial->setUser(null);
  307.             }
  308.         }
  309.         return $this;
  310.     }
  311. //    public function getNftQueue(): ?NftQueue
  312. //    {
  313. //        return $this->nftQueue;
  314. //    }
  315. //
  316. //    public function setNftQueue(NftQueue $nftQueue): self
  317. //    {
  318. //        // set the owning side of the relation if necessary
  319. //        if ($nftQueue->getUser() !== $this) {
  320. //            $nftQueue->setUser($this);
  321. //        }
  322. //
  323. //        $this->nftQueue = $nftQueue;
  324. //
  325. //        return $this;
  326. //    }
  327.     /**
  328.      * @return Collection|SalvageQueue[]
  329.      */
  330.     public function getSalvageQueues(): Collection
  331.     {
  332.         return $this->salvageQueues;
  333.     }
  334.     public function addSalvageQueue(SalvageQueue $salvageQueue): self
  335.     {
  336.         if (!$this->salvageQueues->contains($salvageQueue)) {
  337.             $this->salvageQueues[] = $salvageQueue;
  338.             $salvageQueue->setUser($this);
  339.         }
  340.         return $this;
  341.     }
  342.     public function removeSalvageQueue(SalvageQueue $salvageQueue): self
  343.     {
  344.         if ($this->salvageQueues->removeElement($salvageQueue)) {
  345.             // set the owning side to null (unless already changed)
  346.             if ($salvageQueue->getUser() === $this) {
  347.                 $salvageQueue->setUser(null);
  348.             }
  349.         }
  350.         return $this;
  351.     }
  352.     public function setUsername(?string $username): self
  353.     {
  354.         $this->username $username;
  355.         return $this;
  356.     }
  357.     public function getWalletExtension(): ?int
  358.     {
  359.         return $this->walletExtension;
  360.     }
  361.     public function setWalletExtension(?int $walletExtension): self
  362.     {
  363.         $this->walletExtension $walletExtension;
  364.         return $this;
  365.     }
  366.     public function getConfig(): ?array
  367.     {
  368.         return $this->config;
  369.     }
  370.     public function setConfig(?array $config): self
  371.     {
  372.         $this->config $config;
  373.         return $this;
  374.     }
  375.     public function getActiveWallet(): ?ThetaWallet
  376.     {
  377.         return $this->activeWallet;
  378.     }
  379.     public function setActiveWallet(?ThetaWallet $activeWallet): self
  380.     {
  381.         $this->activeWallet $activeWallet;
  382.         return $this;
  383.     }
  384.     public function getLastRecipeHint(): ?\DateTimeInterface
  385.     {
  386.         return $this->lastRecipeHint;
  387.     }
  388.     public function setLastRecipeHint(?\DateTimeInterface $lastRecipeHint): self
  389.     {
  390.         $this->lastRecipeHint $lastRecipeHint;
  391.         return $this;
  392.     }
  393.     public function getCatchableQueue(): ?CatchableQueue
  394.     {
  395.         return $this->catchableQueue;
  396.     }
  397.     public function setCatchableQueue(CatchableQueue $catchableQueue): self
  398.     {
  399.         // set the owning side of the relation if necessary
  400.         if ($catchableQueue->getUser() !== $this) {
  401.             $catchableQueue->setUser($this);
  402.         }
  403.         $this->catchableQueue $catchableQueue;
  404.         return $this;
  405.     }
  406.     public function getExperience(): ?string
  407.     {
  408.         return $this->experience;
  409.     }
  410.     public function setExperience(?string $experience): self
  411.     {
  412.         $this->experience $experience;
  413.         return $this;
  414.     }
  415.     public function getShadowBanUntil(): ?\DateTimeInterface
  416.     {
  417.         return $this->shadowBanUntil;
  418.     }
  419.     public function setShadowBanUntil(?\DateTimeInterface $shadowBanUntil): self
  420.     {
  421.         $this->shadowBanUntil $shadowBanUntil;
  422.         return $this;
  423.     }
  424.     /**
  425.      * @return Collection<int, ShopItemPurchases>
  426.      */
  427.     public function getShopItemPurchases(): Collection
  428.     {
  429.         return $this->shopItemPurchases;
  430.     }
  431.     public function addShopItemPurchase(ShopItemPurchases $shopItemPurchase): self
  432.     {
  433.         if (!$this->shopItemPurchases->contains($shopItemPurchase)) {
  434.             $this->shopItemPurchases->add($shopItemPurchase);
  435.             $shopItemPurchase->setUser($this);
  436.         }
  437.         return $this;
  438.     }
  439.     public function removeShopItemPurchase(ShopItemPurchases $shopItemPurchase): self
  440.     {
  441.         if ($this->shopItemPurchases->removeElement($shopItemPurchase)) {
  442.             // set the owning side to null (unless already changed)
  443.             if ($shopItemPurchase->getUser() === $this) {
  444.                 $shopItemPurchase->setUser(null);
  445.             }
  446.         }
  447.         return $this;
  448.     }
  449.     public function getShinies(): ?int
  450.     {
  451.         return $this->shinies;
  452.     }
  453.     public function setShinies(?int $shinies): self
  454.     {
  455.         $this->shinies $shinies;
  456.         return $this;
  457.     }
  458.     /**
  459.      * @return Collection<int, Recipe>
  460.      */
  461.     public function getUnlockedRecipes(): Collection
  462.     {
  463.         return $this->unlockedRecipes;
  464.     }
  465.     public function addUnlockedRecipe(Recipe $unlockedRecipe): self
  466.     {
  467.         if (!$this->unlockedRecipes->contains($unlockedRecipe)) {
  468.             $this->unlockedRecipes->add($unlockedRecipe);
  469.         }
  470.         return $this;
  471.     }
  472.     public function removeUnlockedRecipe(Recipe $unlockedRecipe): self
  473.     {
  474.         $this->unlockedRecipes->removeElement($unlockedRecipe);
  475.         return $this;
  476.     }
  477.     public function getGameToken2(): ?string
  478.     {
  479.         return $this->gameToken2;
  480.     }
  481.     public function setGameToken2(?string $gameToken2): self
  482.     {
  483.         $this->gameToken2 $gameToken2;
  484.         return $this;
  485.     }
  486.     public function getActProgression(): ?ActProgression
  487.     {
  488.         return $this->actProgression;
  489.     }
  490.     public function setActProgression(?ActProgression $actProgression): self
  491.     {
  492.         $this->actProgression $actProgression;
  493.         return $this;
  494.     }
  495.     public function getThetaDropWallet(): ?ThetaWallet
  496.     {
  497.         return $this->thetaDropWallet;
  498.     }
  499.     public function setThetaDropWallet(?ThetaWallet $thetaDropWallet): self
  500.     {
  501.         $this->thetaDropWallet $thetaDropWallet;
  502.         return $this;
  503.     }
  504. }