src/Entity/Users.php line 21

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use App\Repository\UsersRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Bridge\Doctrine\Security\User\UserLoaderInterface;
  9. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  10. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  11. use Symfony\Component\Security\Core\User\UserInterface;
  12. /**
  13.  * @UniqueEntity(fields={"email"}, message="There is already an account with this email")
  14.  */
  15. #[ORM\Entity(repositoryClassUsersRepository::class)]
  16. #[ApiResource(routePrefix'/profile')]
  17. class Users implements UserInterfacePasswordAuthenticatedUserInterfaceUserLoaderInterface
  18. {
  19.     #[ORM\Id]
  20.     #[ORM\GeneratedValue]
  21.     #[ORM\Column(type'integer')]
  22.     private $id;
  23.     #[ORM\Column(type'string'length255nullabletrue)]
  24.     public $name;
  25.     #[ORM\Column(type'string'length255nullabletrue)]
  26.     public $surname;
  27.     #[ORM\Column(type'string'length255nullabletrue)]
  28.     public $username;
  29.     #[ORM\Column(type'string'length255nullabletrue)]
  30.     public $email;
  31.     #[ORM\Column(type'float'length255nullabletrue)]
  32.     public $balance;
  33.     #[ORM\Column(type'string'length255nullabletrue)]
  34.     public $password;
  35.     #[ORM\Column(type'string'length255nullabletrue)]
  36.     public $plainPassword;
  37.     #[ORM\Column(type'string'length255nullabletrue)]
  38.     public $canonical;
  39.     #[ORM\Column(type'string'length255nullabletrue)]
  40.     public $paypal;
  41.     #[ORM\Column(type'string'length255nullabletrue)]
  42.     public $kundennumber;
  43.     #[ORM\Column(type'string'length255nullabletrue)]
  44.     public $kundeninvoice;
  45.     #[ORM\Column(type'string'length255nullabletrue)]
  46.     public $api_key;
  47.     #[ORM\ManyToOne(ShopData::class)]
  48.     public $shopID;
  49.     #[ORM\Column(type'string'length255nullabletrue)]
  50.     public $phone;
  51.     #[ORM\Column(type'string'length255nullabletrue)]
  52.     public $blitzkonnectID;
  53.     #[ORM\Column(type'string'length255nullabletrue)]
  54.     public $packet;
  55.     #[ORM\Column(type'string'length255nullabletrue)]
  56.     public $timeEnd;
  57.     #[ORM\Column(type'string'nullabletrue)]
  58.     public $trial;
  59.     #[ORM\Column(type'json')]
  60.     private $roles = [];
  61.     #[ORM\Column(type'string'length255nullabletrue)]
  62.     public $telegramPhone;
  63.     #[ORM\Column(type'string'nullabletrue)]
  64.     private $isVerified null;
  65.     public function getId(): ?int
  66.     {
  67.         return $this->id;
  68.     }
  69.     public function __toString(): string
  70.     {
  71.        return $this->username;
  72.     }
  73.     /**
  74.      * @see UserInterface
  75.      */
  76.     public function getCurrentID(): ?int
  77.     {
  78.         return $this->id;
  79.     }
  80.     /**
  81.      * @see UserInterface
  82.      */
  83.     public function getRoles(): array
  84.     {
  85.         $roles $this->roles;
  86.         // guarantee every user at least has ROLE_USER
  87.         return array_unique($roles);
  88.     }
  89.     /**
  90.      * @see UserInterface
  91.      */
  92.     public function getUserEmail(): string
  93.     {
  94.         $email $this->email;
  95.         // guarantee every user at least has ROLE_USER
  96.         return $email;
  97.     }
  98.     /**
  99.      * @see UserInterface
  100.      */
  101.     public function getRole(): array
  102.     {
  103.         // guarantee every user at least has ROLE_USER
  104.         return $this->roles;
  105.     }
  106.     public function setRoles(array $roles): self
  107.     {
  108.         $this->roles $roles;
  109.         return $this;
  110.     }
  111.     public function eraseCredentials()
  112.     {
  113.         // TODO: Implement eraseCredentials() method.
  114.     }
  115.     public function getProfileImageUrl(): string
  116.     {
  117.         return "https://www.kindpng.com/picc/m/78-786207_user-avatar-png-user-avatar-icon-png-transparent.png";
  118.     }
  119.     public function getMainEmailAddress(): string
  120.     {
  121.         if ($this->email == null) {
  122.             return $this->username;
  123.         } else {
  124.             return $this->email;
  125.         }
  126.     }
  127.     public function getFullName(): string{
  128.         if($this->email == null) {
  129.             return $this->username;
  130.         } else {
  131.             return $this->email;
  132.         }
  133.     }
  134.     public function getUserIdentifier(): string
  135.     {
  136.         if($this->email == null) {
  137.             return $this->username;
  138.         } else {
  139.             return $this->email;
  140.         }
  141.     }
  142.     public function getName(): ?string
  143.     {
  144.         return $this->name;
  145.     }
  146.     public function setName(string $name): self
  147.     {
  148.         $this->name $name;
  149.         return $this;
  150.     }
  151.     public function getSurname(): ?string
  152.     {
  153.         return $this->surname;
  154.     }
  155.     public function setSurname(string $surname): self
  156.     {
  157.         $this->surname $surname;
  158.         return $this;
  159.     }
  160.     public function getUsername(): ?string
  161.     {
  162.         return $this->username;
  163.     }
  164.     public function setUsername(string $username): self
  165.     {
  166.         $this->username $username;
  167.         return $this;
  168.     }
  169.     public function getEmail()
  170.     {
  171.         return $this->email;
  172.     }
  173.     public function setEmail($email): self
  174.     {
  175.         $this->email $email;
  176.         return $this;
  177.     }
  178.     public function getPassword():string
  179.     {
  180.         return $this->password;
  181.     }
  182.     public function setPassword($password): self
  183.     {
  184.         $this->password $password;
  185.         return $this;
  186.     }
  187.     public function getCanonical(): ?string
  188.     {
  189.         return $this->canonical;
  190.     }
  191.     public function setCanonical(string $canonical): self
  192.     {
  193.         $this->canonical $canonical;
  194.         return $this;
  195.     }
  196.     public function getPlainPassword(): ?string
  197.     {
  198.         return $this->plainPassword;
  199.     }
  200.     public function setPlainPassword(string $plainPassword): self
  201.     {
  202.         $this->plainPassword $plainPassword;
  203.         return $this;
  204.     }
  205.     public function getPaypal(): ?string
  206.     {
  207.         return $this->paypal;
  208.     }
  209.     public function setPaypal(string $paypal): self
  210.     {
  211.         $this->paypal $paypal;
  212.         return $this;
  213.     }
  214.     public function getKundennumber(): ?string
  215.     {
  216.         return $this->kundennumber;
  217.     }
  218.     public function setKundennumber(string $kundennumber): self
  219.     {
  220.         $this->kundennumber $kundennumber;
  221.         return $this;
  222.     }
  223.     public function getKundeninvoice(): ?string
  224.     {
  225.         return $this->kundeninvoice;
  226.     }
  227.     public function setKundeninvoice(string $kundeninvoice): self
  228.     {
  229.         $this->kundeninvoice $kundeninvoice;
  230.         return $this;
  231.     }
  232.     public function getShopID(): ?ShopData
  233.     {
  234.         return $this->shopID;
  235.     }
  236.     public function setShopID(ShopData $shopID): self
  237.     {
  238.         $this->shopID $shopID;
  239.         return $this;
  240.     }
  241.     public function getPhone(): ?string
  242.     {
  243.         return $this->phone;
  244.     }
  245.     public function setPhone(string $phone): self
  246.     {
  247.         $this->phone $phone;
  248.         return $this;
  249.     }
  250.     public function getTelegramPhone(): ?string
  251.     {
  252.         return $this->telegramPhone;
  253.     }
  254.     public function setTelegramPhone(string $telegramPhone): self
  255.     {
  256.         $this->telegramPhone $telegramPhone;
  257.         return $this;
  258.     }
  259.     public function loadUserByIdentifier(string $identifier): ?UserInterface
  260.     {
  261.         return $this->username;
  262.     }
  263.     public function getApiKey(): ?string
  264.     {
  265.         return $this->api_key;
  266.     }
  267.     public function setApiKey(string $api_key): self
  268.     {
  269.         $this->api_key $api_key;
  270.         return $this;
  271.     }
  272.     public function getPacket(): ?string
  273.     {
  274.         return $this->packet;
  275.     }
  276.     public function setPacket(?string $packet): self
  277.     {
  278.         $this->packet $packet;
  279.         return $this;
  280.     }
  281.     public function getTimeEnd(): ?string
  282.     {
  283.         return $this->timeEnd;
  284.     }
  285.     public function setTimeEnd(?string $timeEnd): self
  286.     {
  287.         $this->timeEnd $timeEnd;
  288.         return $this;
  289.     }
  290.     public function getTrial()
  291.     {
  292.         return $this->trial;
  293.     }
  294.     public function setTrial($trial): self
  295.     {
  296.         $this->trial $trial;
  297.         return $this;
  298.     }
  299.     public function getIsVerified(): ?string
  300.     {
  301.         return $this->isVerified;
  302.     }
  303.     public function getBlitzkonnectID(): ?string
  304.     {
  305.         return $this->blitzkonnectID;
  306.     }
  307.     public function setBlitzkonnectID(?string $blitzkonnectID): self
  308.     {
  309.         $this->blitzkonnectID $blitzkonnectID;
  310.         return $this;
  311.     }
  312.     public function setIsVerified(?string $isVerified): self
  313.     {
  314.         $this->isVerified $isVerified;
  315.         return $this;
  316.     }
  317.     public function getBalance(): ?float
  318.     {
  319.         return $this->balance;
  320.     }
  321.     public function setBalance(?float $balance): self
  322.     {
  323.         $this->balance $balance;
  324.         return $this;
  325.     }
  326. }