src/Entity/User.php line 15
<?phpnamespace App\Entity;use App\Repository\UserRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;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;#[ORM\Entity(repositoryClass: UserRepository::class)]#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]class User implements UserInterface, PasswordAuthenticatedUserInterface{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 180, unique: true)]private ?string $email = null;#[ORM\Column]private array $roles = [];/*** @var ?string The hashed password*/#[ORM\Column]private ?string $password = '';#[ORM\Column(type: 'boolean')]private bool $isVerified = false;#[ORM\Column(type: 'string')]private string $name;#[ORM\Column(type: 'string')]private string $surName;#[ORM\Column(type: 'integer',nullable: true)]private ?int $verificationCode = null;#[ORM\Column(type: 'string',nullable: true)]private ?string $uuid = null;#[ORM\Column(type: 'string')]private string $phone;#[ORM\Column(type: 'string', nullable: true)]private mixed $birthdate = null;#[ORM\Column(type: 'string')]private string $country;#[ORM\Column(type: 'string')]private string $city;#[ORM\Column(type: 'string')]private string $gender;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Basket::class, cascade: ['persist', 'remove'])]private Collection $basket;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Transaction::class, cascade: ['persist', 'remove'])]private Collection $transaction;public function __construct(){$this->basket = new ArrayCollection();$this->transaction = new ArrayCollection();}public function __toString(): string{return $this->name ?? "";}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(): ?string{return $this->password;}public function setPassword(?string $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 isVerified(): bool{return $this->isVerified;}public function setIsVerified(bool $isVerified): self{$this->isVerified = $isVerified;return $this;}public function isIsVerified(): ?bool{return $this->isVerified;}public function getName(): string{return $this->name;}public function setName(string $name): void{$this->name = $name;}public function getSurName(): string{return $this->surName;}public function setSurName(string $surName): void{$this->surName = $surName;}public function getPhone(): string{return $this->phone;}public function setPhone(string $phone): void{$this->phone = $phone;}public function getBirthdate(): mixed{return $this->birthdate;}public function setBirthdate(mixed $birthdate): void{$this->birthdate = $birthdate;}public function getCountry(): string{return $this->country;}public function setCountry(string $country): void{$this->country = $country;}public function getCity(): string{return $this->city;}public function setCity(string $city): void{$this->city = $city;}public function getGender(): string{return $this->gender;}public function setGender(string $gender): void{$this->gender = $gender;}/*** @return Collection<int, Basket>*/public function getBasket(): Collection{return $this->basket;}public function addBasket(Basket $basket): static{if (!$this->basket->contains($basket)) {$this->basket->add($basket);$basket->setUser($this);}return $this;}public function removeBasket(Basket $basket): static{if ($this->basket->removeElement($basket)) {// set the owning side to null (unless already changed)if ($basket->getUser() === $this) {$basket->setUser(null);}}return $this;}public function getVerificationCode(): ?int{return $this->verificationCode;}public function setVerificationCode(?int $verificationCode): void{$this->verificationCode = $verificationCode;}public function getUuid(): ?string{return $this->uuid;}public function setUuid(?string $uuid): void{$this->uuid = $uuid;}/*** @return Collection<int, Transaction>*/public function getTransaction(): Collection{return $this->transaction;}public function addTransaction(Transaction $transaction): static{if (!$this->transaction->contains($transaction)) {$this->transaction->add($transaction);$transaction->setUser($this);}return $this;}public function removeTransaction(Transaction $transaction): static{if ($this->transaction->removeElement($transaction)) {// set the owning side to null (unless already changed)if ($transaction->getUser() === $this) {$transaction->setUser(null);}}return $this;}}