src/Entity/User.php line 20
<?phpnamespace App\Entity;use App\Entity\Trait\HasTimestampsTrait;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 Gedmo\Mapping\Annotation\SoftDeleteable;use Gedmo\SoftDeleteable\Traits\SoftDeleteableEntity;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)]#[SoftDeleteable(fieldName: 'deletedAt', timeAware: false)]#[ORM\Table(uniqueConstraints: [new ORM\UniqueConstraint(columns: ["email", "deleted_at"])])]class User implements UserInterface, PasswordAuthenticatedUserInterface{use HasTimestampsTrait;use SoftDeleteableEntity;public function __toString(): string{return $this->email;}#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 180)]private ?string $email = null;#[ORM\Column(length: 180)]private ?string $username = 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\OneToMany(mappedBy: 'user', targetEntity: UserFeature::class, cascade: ["persist", "remove"])]protected Collection $userFeature;public function __construct(){$this->userFeature = 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 hasRole($role): bool{return in_array($role, $this->getRoles());}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;}/*** @return string|null*/public function getUsername(): ?string{return $this->username;}/*** @param string|null $username*/public function setUsername(?string $username): void{$this->username = $username;}public function isIsVerified(): ?bool{return $this->isVerified;}/*** @return Collection<int, UserFeature>*/public function getUserFeature(): Collection{return $this->userFeature;}public function addUserFeature(UserFeature $userFeature): static{if (!$this->userFeature->contains($userFeature)) {$this->userFeature->add($userFeature);$userFeature->setUser($this);}return $this;}public function removeUserFeature(UserFeature $userFeature): static{if ($this->userFeature->removeElement($userFeature)) {// set the owning side to null (unless already changed)if ($userFeature->getUser() === $this) {$userFeature->setUser(null);}}return $this;}}