<?php
namespace App\Entity;
use ApiPlatform\Core\Annotation\ApiResource;
use App\Repository\UsersRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
use Symfony\Component\Security\Core\User\UserInterface;
/**
* @UniqueEntity(fields={"email"}, message="There is already an account with this email")
*/
#[ORM\Entity(repositoryClass: UsersRepository::class)]
#[ApiResource(routePrefix: '/profile')]
class Users implements UserInterface, PasswordAuthenticatedUserInterface, UserLoaderInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $name;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $surname;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $username;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $email;
#[ORM\Column(type: 'float', length: 255, nullable: true)]
public $balance;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $password;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $plainPassword;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $canonical;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $paypal;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $kundennumber;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $kundeninvoice;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $api_key;
#[ORM\ManyToOne(ShopData::class)]
public $shopID;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $phone;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $blitzkonnectID;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $packet;
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $timeEnd;
#[ORM\Column(type: 'string', nullable: true)]
public $trial;
#[ORM\Column(type: 'json')]
private $roles = [];
#[ORM\Column(type: 'string', length: 255, nullable: true)]
public $telegramPhone;
#[ORM\Column(type: 'string', nullable: true)]
private $isVerified = null;
public function getId(): ?int
{
return $this->id;
}
public function __toString(): string
{
return $this->username;
}
/**
* @see UserInterface
*/
public function getCurrentID(): ?int
{
return $this->id;
}
/**
* @see UserInterface
*/
public function getRoles(): array
{
$roles = $this->roles;
// guarantee every user at least has ROLE_USER
return array_unique($roles);
}
/**
* @see UserInterface
*/
public function getUserEmail(): string
{
$email = $this->email;
// guarantee every user at least has ROLE_USER
return $email;
}
/**
* @see UserInterface
*/
public function getRole(): array
{
// guarantee every user at least has ROLE_USER
return $this->roles;
}
public function setRoles(array $roles): self
{
$this->roles = $roles;
return $this;
}
public function eraseCredentials()
{
// TODO: Implement eraseCredentials() method.
}
public function getProfileImageUrl(): string
{
return "https://www.kindpng.com/picc/m/78-786207_user-avatar-png-user-avatar-icon-png-transparent.png";
}
public function getMainEmailAddress(): string
{
if ($this->email == null) {
return $this->username;
} else {
return $this->email;
}
}
public function getFullName(): string{
if($this->email == null) {
return $this->username;
} else {
return $this->email;
}
}
public function getUserIdentifier(): string
{
if($this->email == null) {
return $this->username;
} else {
return $this->email;
}
}
public function getName(): ?string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function getSurname(): ?string
{
return $this->surname;
}
public function setSurname(string $surname): self
{
$this->surname = $surname;
return $this;
}
public function getUsername(): ?string
{
return $this->username;
}
public function setUsername(string $username): self
{
$this->username = $username;
return $this;
}
public function getEmail()
{
return $this->email;
}
public function setEmail($email): self
{
$this->email = $email;
return $this;
}
public function getPassword():string
{
return $this->password;
}
public function setPassword($password): self
{
$this->password = $password;
return $this;
}
public function getCanonical(): ?string
{
return $this->canonical;
}
public function setCanonical(string $canonical): self
{
$this->canonical = $canonical;
return $this;
}
public function getPlainPassword(): ?string
{
return $this->plainPassword;
}
public function setPlainPassword(string $plainPassword): self
{
$this->plainPassword = $plainPassword;
return $this;
}
public function getPaypal(): ?string
{
return $this->paypal;
}
public function setPaypal(string $paypal): self
{
$this->paypal = $paypal;
return $this;
}
public function getKundennumber(): ?string
{
return $this->kundennumber;
}
public function setKundennumber(string $kundennumber): self
{
$this->kundennumber = $kundennumber;
return $this;
}
public function getKundeninvoice(): ?string
{
return $this->kundeninvoice;
}
public function setKundeninvoice(string $kundeninvoice): self
{
$this->kundeninvoice = $kundeninvoice;
return $this;
}
public function getShopID(): ?ShopData
{
return $this->shopID;
}
public function setShopID(ShopData $shopID): self
{
$this->shopID = $shopID;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getTelegramPhone(): ?string
{
return $this->telegramPhone;
}
public function setTelegramPhone(string $telegramPhone): self
{
$this->telegramPhone = $telegramPhone;
return $this;
}
public function loadUserByIdentifier(string $identifier): ?UserInterface
{
return $this->username;
}
public function getApiKey(): ?string
{
return $this->api_key;
}
public function setApiKey(string $api_key): self
{
$this->api_key = $api_key;
return $this;
}
public function getPacket(): ?string
{
return $this->packet;
}
public function setPacket(?string $packet): self
{
$this->packet = $packet;
return $this;
}
public function getTimeEnd(): ?string
{
return $this->timeEnd;
}
public function setTimeEnd(?string $timeEnd): self
{
$this->timeEnd = $timeEnd;
return $this;
}
public function getTrial()
{
return $this->trial;
}
public function setTrial($trial): self
{
$this->trial = $trial;
return $this;
}
public function getIsVerified(): ?string
{
return $this->isVerified;
}
public function getBlitzkonnectID(): ?string
{
return $this->blitzkonnectID;
}
public function setBlitzkonnectID(?string $blitzkonnectID): self
{
$this->blitzkonnectID = $blitzkonnectID;
return $this;
}
public function setIsVerified(?string $isVerified): self
{
$this->isVerified = $isVerified;
return $this;
}
public function getBalance(): ?float
{
return $this->balance;
}
public function setBalance(?float $balance): self
{
$this->balance = $balance;
return $this;
}
}