src/Entity/User.php line 18
<?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;
use Symfony\Component\Validator\Constraints as Assert;
#[ORM\Entity(repositoryClass: UserRepository::class)]
#[UniqueEntity(fields: "email", message: "Email je zauzet")]
#[UniqueEntity(fields: "username", message: "Korisničko ime je zauzeto")]
class User implements UserInterface, PasswordAuthenticatedUserInterface
{
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column(type: 'integer')]
private $id;
#[ORM\Column(type: 'string', length: 180, unique: true)]
private $email;
#[ORM\Column(type: 'json')]
private $roles = ["ROLE_USER"];
#[ORM\Column(type: 'string', nullable: true)]
private $password;
#[ORM\Column(type: 'string', length: 255, unique: true, nullable: true)]
private $username;
#[ORM\Column(type: 'boolean', nullable: true)]
private $isActive;
#[ORM\Column(length: 255, nullable: true)]
private ?string $confirmationToken = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $firstName = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $lastName = null;
#[ORM\Column(length: 100, nullable: true)]
private ?string $city = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $phone = null;
#[ORM\Column(length: 500, nullable: true)]
private ?string $companyName = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $pin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $address = null;
#[ORM\Column(nullable: true)]
private ?bool $newsletter = null;
#[ORM\Column(length: 20, nullable: true)]
private ?string $zipcode = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $newPassword = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Orders::class)]
#[ORM\OrderBy(['id' => 'DESC'])]
private Collection $orders;
#[ORM\Column(nullable: true)]
private ?int $remoteId = null;
#[ORM\Column(nullable: true)]
private ?bool $registrationFinished = null;
#[ORM\Column(nullable: true)]
private ?int $accountId = null;
#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]
private ?\DateTimeInterface $cardExpDate = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $file1 = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $file2 = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $file1Status = null;
#[ORM\Column(type: Types::SMALLINT, nullable: true)]
private ?int $file2Status = null;
#[ORM\Column(nullable: true)]
private ?bool $portalMigration = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $profilePic = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Numbers::class)]
private Collection $numbers;
#[ORM\Column(length: 255, nullable: true)]
private ?string $companyPerson = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $companyPersonPin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $companyAddress = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $companyPlace = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $representationPerson = null;
#[ORM\Column(length: 50, nullable: true)]
private ?string $representationPersonPin = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $emailForReceipt = null;
#[ORM\Column(length: 255, nullable: true)]
private ?string $sellerName = null;
#[ORM\Column(nullable: true)]
private ?float $productCustomPrice = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: RequestDataChange::class)]
private Collection $requestDataChanges;
#[ORM\Column(type: Types::TEXT, nullable: true)]
private ?string $notice = null;
#[ORM\OneToMany(mappedBy: 'user', targetEntity: Invoice::class)]
private Collection $invoices;
#[ORM\Column(nullable: true)]
private ?bool $chargeSamePrice = null;
public function __construct()
{
$this->orders = new ArrayCollection();
$this->numbers = new ArrayCollection();
$this->requestDataChanges = new ArrayCollection();
$this->invoices = 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;
}
/**
* @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(): null|string
{
return $this->password;
}
public function setPassword($password): self
{
$this->password = $password;
return $this;
}
/**
* @see UserInterface
*/
public function eraseCredentials()
{
// If you store any temporary, sensitive data on the user, clear it here
// $this->plainPassword = null;
}
public function getUsername()
{
return $this->username;
}
public function setUsername($username): self
{
$this->username = $username;
return $this;
}
public function getIsActive(): ?bool
{
return $this->isActive;
}
public function setIsActive(?bool $isActive): self
{
$this->isActive = $isActive;
return $this;
}
public function getConfirmationToken(): ?string
{
return $this->confirmationToken;
}
public function setConfirmationToken(?string $confirmationToken): self
{
$this->confirmationToken = $confirmationToken;
return $this;
}
public function getFirstName(): ?string
{
return $this->firstName;
}
public function setFirstName(?string $firstName): self
{
$this->firstName = $firstName;
return $this;
}
public function getLastName(): ?string
{
return $this->lastName;
}
public function setLastName(?string $lastName): self
{
$this->lastName = $lastName;
return $this;
}
public function getCity(): ?string
{
return $this->city;
}
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
public function getPhone(): ?string
{
return $this->phone;
}
public function setPhone(?string $phone): self
{
$this->phone = $phone;
return $this;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): self
{
$this->companyName = $companyName;
return $this;
}
public function getPin(): ?string
{
return $this->pin;
}
public function setPin(?string $pin): self
{
$this->pin = $pin;
return $this;
}
public function getAddress(): ?string
{
return $this->address;
}
public function setAddress(?string $address): self
{
$this->address = $address;
return $this;
}
public function isNewsletter(): ?bool
{
return $this->newsletter;
}
public function setNewsletter(?bool $newsletter): self
{
$this->newsletter = $newsletter;
return $this;
}
public function getZipcode(): ?string
{
return $this->zipcode;
}
public function setZipcode(?string $zipcode): self
{
$this->zipcode = $zipcode;
return $this;
}
public function getNewPassword(): ?string
{
return $this->newPassword;
}
public function setNewPassword(?string $newPassword): self
{
$this->newPassword = $newPassword;
return $this;
}
/**
* @return Collection<int, Orders>
*/
public function getOrders(): Collection
{
return $this->orders;
}
public function addOrder(Orders $order): self
{
if (!$this->orders->contains($order)) {
$this->orders->add($order);
$order->setUser($this);
}
return $this;
}
public function removeOrder(Orders $order): self
{
if ($this->orders->removeElement($order)) {
// set the owning side to null (unless already changed)
if ($order->getUser() === $this) {
$order->setUser(null);
}
}
return $this;
}
public function getRemoteId(): ?int
{
return $this->remoteId;
}
public function setRemoteId(?int $remoteId): self
{
$this->remoteId = $remoteId;
return $this;
}
public function isRegistrationFinished(): ?bool
{
return $this->registrationFinished;
}
public function setRegistrationFinished(?bool $registrationFinished): self
{
$this->registrationFinished = $registrationFinished;
return $this;
}
public function getAccountId(): ?int
{
return $this->accountId;
}
public function setAccountId(?int $accountId): self
{
$this->accountId = $accountId;
return $this;
}
public function getCardExpDate(): ?\DateTimeInterface
{
return $this->cardExpDate;
}
public function setCardExpDate(?\DateTimeInterface $cardExpDate): self
{
$this->cardExpDate = $cardExpDate;
return $this;
}
public function getFile1(): ?string
{
return $this->file1;
}
public function setFile1(?string $file1): self
{
$this->file1 = $file1;
return $this;
}
public function getFile2(): ?string
{
return $this->file2;
}
public function setFile2(?string $file2): self
{
$this->file2 = $file2;
return $this;
}
public function getFile1Status(): ?int
{
return $this->file1Status;
}
public function setFile1Status(?int $file1Status): self
{
$this->file1Status = $file1Status;
return $this;
}
public function getFile2Status(): ?int
{
return $this->file2Status;
}
public function setFile2Status(?int $file2Status): self
{
$this->file2Status = $file2Status;
return $this;
}
public function isPortalMigration(): ?bool
{
return $this->portalMigration;
}
public function setPortalMigration(?bool $portalMigration): self
{
$this->portalMigration = $portalMigration;
return $this;
}
public function getProfilePic(): ?string
{
return $this->profilePic;
}
public function setProfilePic(?string $profilePic): self
{
$this->profilePic = $profilePic;
return $this;
}
/**
* @return Collection<int, Numbers>
*/
public function getNumbers(): Collection
{
return $this->numbers;
}
/**
* @return Collection<int, Numbers>
*/
public function getActiveNumbers(): Collection
{
$numbers = new ArrayCollection();
/** @var Numbers $number */
foreach ($this->numbers as $number) {
if($number->isActive()) {
$numbers->add($number);
}
}
return $numbers;
}
public function addNumber(Numbers $number): self
{
if (!$this->numbers->contains($number)) {
$this->numbers->add($number);
$number->setUser($this);
}
return $this;
}
public function removeNumber(Numbers $number): self
{
if ($this->numbers->removeElement($number)) {
// set the owning side to null (unless already changed)
if ($number->getUser() === $this) {
$number->setUser(null);
}
}
return $this;
}
public function getCompanyPerson(): ?string
{
return $this->companyPerson;
}
public function setCompanyPerson(?string $companyPerson): self
{
$this->companyPerson = $companyPerson;
return $this;
}
public function getCompanyPersonPin(): ?string
{
return $this->companyPersonPin;
}
public function setCompanyPersonPin(?string $companyPersonPin): self
{
$this->companyPersonPin = $companyPersonPin;
return $this;
}
public function getCompanyAddress(): ?string
{
return $this->companyAddress;
}
public function setCompanyAddress(?string $companyAddress): self
{
$this->companyAddress = $companyAddress;
return $this;
}
public function getCompanyPlace(): ?string
{
return $this->companyPlace;
}
public function setCompanyPlace(?string $companyPlace): self
{
$this->companyPlace = $companyPlace;
return $this;
}
public function getRepresentationPerson(): ?string
{
return $this->representationPerson;
}
public function setRepresentationPerson(?string $representationPerson): self
{
$this->representationPerson = $representationPerson;
return $this;
}
public function getRepresentationPersonPin(): ?string
{
return $this->representationPersonPin;
}
public function setRepresentationPersonPin(?string $representationPersonPin): self
{
$this->representationPersonPin = $representationPersonPin;
return $this;
}
public function getEmailForReceipt(): ?string
{
return $this->emailForReceipt;
}
public function setEmailForReceipt(?string $emailForReceipt): self
{
$this->emailForReceipt = $emailForReceipt;
return $this;
}
public function getSellerName(): ?string
{
return $this->sellerName;
}
public function setSellerName(?string $sellerName): self
{
$this->sellerName = $sellerName;
return $this;
}
public function getProductCustomPrice(): ?float
{
return $this->productCustomPrice;
}
public function setProductCustomPrice(?float $productCustomPrice): self
{
$this->productCustomPrice = $productCustomPrice;
return $this;
}
/**
* @return Collection<int, RequestDataChange>
*/
public function getRequestDataChanges(): Collection
{
return $this->requestDataChanges;
}
public function addRequestDataChange(RequestDataChange $requestDataChange): self
{
if (!$this->requestDataChanges->contains($requestDataChange)) {
$this->requestDataChanges->add($requestDataChange);
$requestDataChange->setUser($this);
}
return $this;
}
public function removeRequestDataChange(RequestDataChange $requestDataChange): self
{
if ($this->requestDataChanges->removeElement($requestDataChange)) {
// set the owning side to null (unless already changed)
if ($requestDataChange->getUser() === $this) {
$requestDataChange->setUser(null);
}
}
return $this;
}
public function getNotice(): ?string
{
return $this->notice;
}
public function setNotice(?string $notice): self
{
$this->notice = $notice;
return $this;
}
/**
* @return Collection<int, Invoice>
*/
public function getInvoices(): Collection
{
return $this->invoices;
}
public function addInvoice(Invoice $invoice): self
{
if (!$this->invoices->contains($invoice)) {
$this->invoices->add($invoice);
$invoice->setUser($this);
}
return $this;
}
public function removeInvoice(Invoice $invoice): self
{
if ($this->invoices->removeElement($invoice)) {
// set the owning side to null (unless already changed)
if ($invoice->getUser() === $this) {
$invoice->setUser(null);
}
}
return $this;
}
public function isChargeSamePrice(): ?bool
{
return $this->chargeSamePrice;
}
public function setChargeSamePrice(?bool $chargeSamePrice): self
{
$this->chargeSamePrice = $chargeSamePrice;
return $this;
}
}