src/Entity/User.php line 18

  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. use Symfony\Component\Validator\Constraints as Assert;
  12. #[ORM\Entity(repositoryClassUserRepository::class)]
  13. #[UniqueEntity(fields"email"message"Email je zauzet")]
  14. #[UniqueEntity(fields"username"message"Korisničko ime je zauzeto")]
  15. class User implements UserInterfacePasswordAuthenticatedUserInterface
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column(type'integer')]
  20.     private $id;
  21.     #[ORM\Column(type'string'length180uniquetrue)]
  22.     private $email;
  23.     #[ORM\Column(type'json')]
  24.     private $roles = ["ROLE_USER"];
  25.     #[ORM\Column(type'string'nullabletrue)]
  26.     private $password;
  27.     #[ORM\Column(type'string'length255uniquetruenullabletrue)]
  28.     private $username;
  29.     #[ORM\Column(type'boolean'nullabletrue)]
  30.     private $isActive;
  31.     #[ORM\Column(length255nullabletrue)]
  32.     private ?string $confirmationToken null;
  33.     #[ORM\Column(length100nullabletrue)]
  34.     private ?string $firstName null;
  35.     #[ORM\Column(length100nullabletrue)]
  36.     private ?string $lastName null;
  37.     #[ORM\Column(length100nullabletrue)]
  38.     private ?string $city null;
  39.     #[ORM\Column(length50nullabletrue)]
  40.     private ?string $phone null;
  41.     #[ORM\Column(length500nullabletrue)]
  42.     private ?string $companyName null;
  43.     #[ORM\Column(length50nullabletrue)]
  44.     private ?string $pin null;
  45.     #[ORM\Column(length255nullabletrue)]
  46.     private ?string $address null;
  47.     #[ORM\Column(nullabletrue)]
  48.     private ?bool $newsletter null;
  49.     #[ORM\Column(length20nullabletrue)]
  50.     private ?string $zipcode null;
  51.     #[ORM\Column(length255nullabletrue)]
  52.     private ?string $newPassword null;
  53.     #[ORM\OneToMany(mappedBy'user'targetEntityOrders::class)]
  54.     #[ORM\OrderBy(['id' => 'DESC'])]
  55.     private Collection $orders;
  56.     #[ORM\Column(nullabletrue)]
  57.     private ?int $remoteId null;
  58.     #[ORM\Column(nullabletrue)]
  59.     private ?bool $registrationFinished null;
  60.     #[ORM\Column(nullabletrue)]
  61.     private ?int $accountId null;
  62.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  63.     private ?\DateTimeInterface $cardExpDate null;
  64.     #[ORM\Column(length255nullabletrue)]
  65.     private ?string $file1 null;
  66.     #[ORM\Column(length255nullabletrue)]
  67.     private ?string $file2 null;
  68.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  69.     private ?int $file1Status null;
  70.     #[ORM\Column(typeTypes::SMALLINTnullabletrue)]
  71.     private ?int $file2Status null;
  72.     #[ORM\Column(nullabletrue)]
  73.     private ?bool $portalMigration null;
  74.     #[ORM\Column(length255nullabletrue)]
  75.     private ?string $profilePic null;
  76.     #[ORM\OneToMany(mappedBy'user'targetEntityNumbers::class)]
  77.     private Collection $numbers;
  78.     #[ORM\Column(length255nullabletrue)]
  79.     private ?string $companyPerson null;
  80.     #[ORM\Column(length50nullabletrue)]
  81.     private ?string $companyPersonPin null;
  82.     #[ORM\Column(length255nullabletrue)]
  83.     private ?string $companyAddress null;
  84.     #[ORM\Column(length255nullabletrue)]
  85.     private ?string $companyPlace null;
  86.     #[ORM\Column(length255nullabletrue)]
  87.     private ?string $representationPerson null;
  88.     #[ORM\Column(length50nullabletrue)]
  89.     private ?string $representationPersonPin null;
  90.     #[ORM\Column(length255nullabletrue)]
  91.     private ?string $emailForReceipt null;
  92.     #[ORM\Column(length255nullabletrue)]
  93.     private ?string $sellerName null;
  94.     #[ORM\Column(nullabletrue)]
  95.     private ?float $productCustomPrice null;
  96.     #[ORM\OneToMany(mappedBy'user'targetEntityRequestDataChange::class)]
  97.     private Collection $requestDataChanges;
  98.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  99.     private ?string $notice null;
  100.     #[ORM\OneToMany(mappedBy'user'targetEntityInvoice::class)]
  101.     private Collection $invoices;
  102.     #[ORM\Column(nullabletrue)]
  103.     private ?bool $chargeSamePrice null;
  104.     public function __construct()
  105.     {
  106.         $this->orders = new ArrayCollection();
  107.         $this->numbers = new ArrayCollection();
  108.         $this->requestDataChanges = new ArrayCollection();
  109.         $this->invoices = new ArrayCollection();
  110.     }
  111.     public function getId(): ?int
  112.     {
  113.         return $this->id;
  114.     }
  115.     public function getEmail(): ?string
  116.     {
  117.         return $this->email;
  118.     }
  119.     public function setEmail(string $email): self
  120.     {
  121.         $this->email $email;
  122.         return $this;
  123.     }
  124.     /**
  125.      * A visual identifier that represents this user.
  126.      *
  127.      * @see UserInterface
  128.      */
  129.     public function getUserIdentifier(): string
  130.     {
  131.         return (string) $this->email;
  132.     }
  133.     /**
  134.      * @see UserInterface
  135.      */
  136.     public function getRoles(): array
  137.     {
  138.         $roles $this->roles;
  139.         // guarantee every user at least has ROLE_USER
  140.         $roles[] = 'ROLE_USER';
  141.         return array_unique($roles);
  142.     }
  143.     public function setRoles(array $roles): self
  144.     {
  145.         $this->roles $roles;
  146.         return $this;
  147.     }
  148.     /**
  149.      * @see PasswordAuthenticatedUserInterface
  150.      */
  151.     public function getPassword(): null|string
  152.     {
  153.         return $this->password;
  154.     }
  155.     public function setPassword($password): self
  156.     {
  157.         $this->password $password;
  158.         return $this;
  159.     }
  160.     /**
  161.      * @see UserInterface
  162.      */
  163.     public function eraseCredentials()
  164.     {
  165.         // If you store any temporary, sensitive data on the user, clear it here
  166.         // $this->plainPassword = null;
  167.     }
  168.     public function getUsername()
  169.     {
  170.         return $this->username;
  171.     }
  172.     public function setUsername($username): self
  173.     {
  174.         $this->username $username;
  175.         return $this;
  176.     }
  177.     public function getIsActive(): ?bool
  178.     {
  179.         return $this->isActive;
  180.     }
  181.     public function setIsActive(?bool $isActive): self
  182.     {
  183.         $this->isActive $isActive;
  184.         return $this;
  185.     }
  186.     public function getConfirmationToken(): ?string
  187.     {
  188.         return $this->confirmationToken;
  189.     }
  190.     public function setConfirmationToken(?string $confirmationToken): self
  191.     {
  192.         $this->confirmationToken $confirmationToken;
  193.         return $this;
  194.     }
  195.     public function getFirstName(): ?string
  196.     {
  197.         return $this->firstName;
  198.     }
  199.     public function setFirstName(?string $firstName): self
  200.     {
  201.         $this->firstName $firstName;
  202.         return $this;
  203.     }
  204.     public function getLastName(): ?string
  205.     {
  206.         return $this->lastName;
  207.     }
  208.     public function setLastName(?string $lastName): self
  209.     {
  210.         $this->lastName $lastName;
  211.         return $this;
  212.     }
  213.     public function getCity(): ?string
  214.     {
  215.         return $this->city;
  216.     }
  217.     public function setCity(?string $city): self
  218.     {
  219.         $this->city $city;
  220.         return $this;
  221.     }
  222.     public function getPhone(): ?string
  223.     {
  224.         return $this->phone;
  225.     }
  226.     public function setPhone(?string $phone): self
  227.     {
  228.         $this->phone $phone;
  229.         return $this;
  230.     }
  231.     public function getCompanyName(): ?string
  232.     {
  233.         return $this->companyName;
  234.     }
  235.     public function setCompanyName(?string $companyName): self
  236.     {
  237.         $this->companyName $companyName;
  238.         return $this;
  239.     }
  240.     public function getPin(): ?string
  241.     {
  242.         return $this->pin;
  243.     }
  244.     public function setPin(?string $pin): self
  245.     {
  246.         $this->pin $pin;
  247.         return $this;
  248.     }
  249.     public function getAddress(): ?string
  250.     {
  251.         return $this->address;
  252.     }
  253.     public function setAddress(?string $address): self
  254.     {
  255.         $this->address $address;
  256.         return $this;
  257.     }
  258.     public function isNewsletter(): ?bool
  259.     {
  260.         return $this->newsletter;
  261.     }
  262.     public function setNewsletter(?bool $newsletter): self
  263.     {
  264.         $this->newsletter $newsletter;
  265.         return $this;
  266.     }
  267.     public function getZipcode(): ?string
  268.     {
  269.         return $this->zipcode;
  270.     }
  271.     public function setZipcode(?string $zipcode): self
  272.     {
  273.         $this->zipcode $zipcode;
  274.         return $this;
  275.     }
  276.     public function getNewPassword(): ?string
  277.     {
  278.         return $this->newPassword;
  279.     }
  280.     public function setNewPassword(?string $newPassword): self
  281.     {
  282.         $this->newPassword $newPassword;
  283.         return $this;
  284.     }
  285.     /**
  286.      * @return Collection<int, Orders>
  287.      */
  288.     public function getOrders(): Collection
  289.     {
  290.         return $this->orders;
  291.     }
  292.     public function addOrder(Orders $order): self
  293.     {
  294.         if (!$this->orders->contains($order)) {
  295.             $this->orders->add($order);
  296.             $order->setUser($this);
  297.         }
  298.         return $this;
  299.     }
  300.     public function removeOrder(Orders $order): self
  301.     {
  302.         if ($this->orders->removeElement($order)) {
  303.             // set the owning side to null (unless already changed)
  304.             if ($order->getUser() === $this) {
  305.                 $order->setUser(null);
  306.             }
  307.         }
  308.         return $this;
  309.     }
  310.     public function getRemoteId(): ?int
  311.     {
  312.         return $this->remoteId;
  313.     }
  314.     public function setRemoteId(?int $remoteId): self
  315.     {
  316.         $this->remoteId $remoteId;
  317.         return $this;
  318.     }
  319.     public function isRegistrationFinished(): ?bool
  320.     {
  321.         return $this->registrationFinished;
  322.     }
  323.     public function setRegistrationFinished(?bool $registrationFinished): self
  324.     {
  325.         $this->registrationFinished $registrationFinished;
  326.         return $this;
  327.     }
  328.     public function getAccountId(): ?int
  329.     {
  330.         return $this->accountId;
  331.     }
  332.     public function setAccountId(?int $accountId): self
  333.     {
  334.         $this->accountId $accountId;
  335.         return $this;
  336.     }
  337.     public function getCardExpDate(): ?\DateTimeInterface
  338.     {
  339.         return $this->cardExpDate;
  340.     }
  341.     public function setCardExpDate(?\DateTimeInterface $cardExpDate): self
  342.     {
  343.         $this->cardExpDate $cardExpDate;
  344.         return $this;
  345.     }
  346.     public function getFile1(): ?string
  347.     {
  348.         return $this->file1;
  349.     }
  350.     public function setFile1(?string $file1): self
  351.     {
  352.         $this->file1 $file1;
  353.         return $this;
  354.     }
  355.     public function getFile2(): ?string
  356.     {
  357.         return $this->file2;
  358.     }
  359.     public function setFile2(?string $file2): self
  360.     {
  361.         $this->file2 $file2;
  362.         return $this;
  363.     }
  364.     public function getFile1Status(): ?int
  365.     {
  366.         return $this->file1Status;
  367.     }
  368.     public function setFile1Status(?int $file1Status): self
  369.     {
  370.         $this->file1Status $file1Status;
  371.         return $this;
  372.     }
  373.     public function getFile2Status(): ?int
  374.     {
  375.         return $this->file2Status;
  376.     }
  377.     public function setFile2Status(?int $file2Status): self
  378.     {
  379.         $this->file2Status $file2Status;
  380.         return $this;
  381.     }
  382.     public function isPortalMigration(): ?bool
  383.     {
  384.         return $this->portalMigration;
  385.     }
  386.     public function setPortalMigration(?bool $portalMigration): self
  387.     {
  388.         $this->portalMigration $portalMigration;
  389.         return $this;
  390.     }
  391.     public function getProfilePic(): ?string
  392.     {
  393.         return $this->profilePic;
  394.     }
  395.     public function setProfilePic(?string $profilePic): self
  396.     {
  397.         $this->profilePic $profilePic;
  398.         return $this;
  399.     }
  400.     /**
  401.      * @return Collection<int, Numbers>
  402.      */
  403.     public function getNumbers(): Collection
  404.     {
  405.         return $this->numbers;
  406.     }
  407.     /**
  408.      * @return Collection<int, Numbers>
  409.      */
  410.     public function getActiveNumbers(): Collection
  411.     {
  412.         $numbers = new ArrayCollection();
  413.         /** @var Numbers $number */
  414.         foreach ($this->numbers as $number) {
  415.             if($number->isActive()) {
  416.                 $numbers->add($number);
  417.             }
  418.         }
  419.         return $numbers;
  420.     }
  421.     public function addNumber(Numbers $number): self
  422.     {
  423.         if (!$this->numbers->contains($number)) {
  424.             $this->numbers->add($number);
  425.             $number->setUser($this);
  426.         }
  427.         return $this;
  428.     }
  429.     public function removeNumber(Numbers $number): self
  430.     {
  431.         if ($this->numbers->removeElement($number)) {
  432.             // set the owning side to null (unless already changed)
  433.             if ($number->getUser() === $this) {
  434.                 $number->setUser(null);
  435.             }
  436.         }
  437.         return $this;
  438.     }
  439.     public function getCompanyPerson(): ?string
  440.     {
  441.         return $this->companyPerson;
  442.     }
  443.     public function setCompanyPerson(?string $companyPerson): self
  444.     {
  445.         $this->companyPerson $companyPerson;
  446.         return $this;
  447.     }
  448.     public function getCompanyPersonPin(): ?string
  449.     {
  450.         return $this->companyPersonPin;
  451.     }
  452.     public function setCompanyPersonPin(?string $companyPersonPin): self
  453.     {
  454.         $this->companyPersonPin $companyPersonPin;
  455.         return $this;
  456.     }
  457.     public function getCompanyAddress(): ?string
  458.     {
  459.         return $this->companyAddress;
  460.     }
  461.     public function setCompanyAddress(?string $companyAddress): self
  462.     {
  463.         $this->companyAddress $companyAddress;
  464.         return $this;
  465.     }
  466.     public function getCompanyPlace(): ?string
  467.     {
  468.         return $this->companyPlace;
  469.     }
  470.     public function setCompanyPlace(?string $companyPlace): self
  471.     {
  472.         $this->companyPlace $companyPlace;
  473.         return $this;
  474.     }
  475.     public function getRepresentationPerson(): ?string
  476.     {
  477.         return $this->representationPerson;
  478.     }
  479.     public function setRepresentationPerson(?string $representationPerson): self
  480.     {
  481.         $this->representationPerson $representationPerson;
  482.         return $this;
  483.     }
  484.     public function getRepresentationPersonPin(): ?string
  485.     {
  486.         return $this->representationPersonPin;
  487.     }
  488.     public function setRepresentationPersonPin(?string $representationPersonPin): self
  489.     {
  490.         $this->representationPersonPin $representationPersonPin;
  491.         return $this;
  492.     }
  493.     public function getEmailForReceipt(): ?string
  494.     {
  495.         return $this->emailForReceipt;
  496.     }
  497.     public function setEmailForReceipt(?string $emailForReceipt): self
  498.     {
  499.         $this->emailForReceipt $emailForReceipt;
  500.         return $this;
  501.     }
  502.     public function getSellerName(): ?string
  503.     {
  504.         return $this->sellerName;
  505.     }
  506.     public function setSellerName(?string $sellerName): self
  507.     {
  508.         $this->sellerName $sellerName;
  509.         return $this;
  510.     }
  511.     public function getProductCustomPrice(): ?float
  512.     {
  513.         return $this->productCustomPrice;
  514.     }
  515.     public function setProductCustomPrice(?float $productCustomPrice): self
  516.     {
  517.         $this->productCustomPrice $productCustomPrice;
  518.         return $this;
  519.     }
  520.     /**
  521.      * @return Collection<int, RequestDataChange>
  522.      */
  523.     public function getRequestDataChanges(): Collection
  524.     {
  525.         return $this->requestDataChanges;
  526.     }
  527.     public function addRequestDataChange(RequestDataChange $requestDataChange): self
  528.     {
  529.         if (!$this->requestDataChanges->contains($requestDataChange)) {
  530.             $this->requestDataChanges->add($requestDataChange);
  531.             $requestDataChange->setUser($this);
  532.         }
  533.         return $this;
  534.     }
  535.     public function removeRequestDataChange(RequestDataChange $requestDataChange): self
  536.     {
  537.         if ($this->requestDataChanges->removeElement($requestDataChange)) {
  538.             // set the owning side to null (unless already changed)
  539.             if ($requestDataChange->getUser() === $this) {
  540.                 $requestDataChange->setUser(null);
  541.             }
  542.         }
  543.         return $this;
  544.     }
  545.     public function getNotice(): ?string
  546.     {
  547.         return $this->notice;
  548.     }
  549.     public function setNotice(?string $notice): self
  550.     {
  551.         $this->notice $notice;
  552.         return $this;
  553.     }
  554.     /**
  555.      * @return Collection<int, Invoice>
  556.      */
  557.     public function getInvoices(): Collection
  558.     {
  559.         return $this->invoices;
  560.     }
  561.     public function addInvoice(Invoice $invoice): self
  562.     {
  563.         if (!$this->invoices->contains($invoice)) {
  564.             $this->invoices->add($invoice);
  565.             $invoice->setUser($this);
  566.         }
  567.         return $this;
  568.     }
  569.     public function removeInvoice(Invoice $invoice): self
  570.     {
  571.         if ($this->invoices->removeElement($invoice)) {
  572.             // set the owning side to null (unless already changed)
  573.             if ($invoice->getUser() === $this) {
  574.                 $invoice->setUser(null);
  575.             }
  576.         }
  577.         return $this;
  578.     }
  579.     public function isChargeSamePrice(): ?bool
  580.     {
  581.         return $this->chargeSamePrice;
  582.     }
  583.     public function setChargeSamePrice(?bool $chargeSamePrice): self
  584.     {
  585.         $this->chargeSamePrice $chargeSamePrice;
  586.         return $this;
  587.     }
  588. }