src/Entity/User.php line 13
<?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\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;#[ORM\Entity(repositoryClass: UserRepository::class)]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 = [];/*** @var string The hashed password*/#[ORM\Column(type: 'string', nullable: true)]private $password;#[ORM\Column(type: 'string', length: 255)]private $firstName;#[ORM\Column(type: 'string', length: 255)]private $lastName;#[ORM\Column(type: 'datetime')]private $modified;#[ORM\Column(type: 'datetime')]private $created;#[ORM\OneToMany(targetEntity: ArticleDetails::class, mappedBy: 'user')]private $articleDetails;#[ORM\Column(type: 'string', length: 255, nullable: true)]private $hashedEmail;public function __construct(){$date = new \DateTime("now", new \DateTimeZone('Asia/Dubai'));$this->setModified($date);if ($this->getCreated() == null){$this->setCreated($date);}$this->articleDetails = 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;}/*** @deprecated since Symfony 5.3, use getUserIdentifier instead*/public function getUsername(): 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;}/*** Returning a salt is only needed, if you are not using a modern* hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.** @see UserInterface*/public function getSalt(): ?string{return null;}/*** @see UserInterface*/public function eraseCredentials(){// If you inventory any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}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 getModified(): ?\DateTimeInterface{return $this->modified;}public function setModified(\DateTimeInterface $modified): self{$this->modified = $modified;return $this;}public function getCreated(): ?\DateTimeInterface{return $this->created;}public function setCreated(\DateTimeInterface $created): self{$this->created = $created;return $this;}/*** @return Collection<int, ArticleDetails>*/public function getArticleDetails(): Collection{return $this->articleDetails;}public function addArticleDetail(ArticleDetails $articleDetail): self{if (!$this->articleDetails->contains($articleDetail)) {$this->articleDetails[] = $articleDetail;$articleDetail->setUser($this);}return $this;}public function removeArticleDetail(ArticleDetails $articleDetail): self{if ($this->articleDetails->removeElement($articleDetail)) {// set the owning side to null (unless already changed)if ($articleDetail->getUser() === $this) {$articleDetail->setUser(null);}}return $this;}public function getHashedEmail(): ?string{return $this->hashedEmail;}public function setHashedEmail(?string $hashedEmail): self{$this->hashedEmail = $hashedEmail;return $this;}}