src/Entity/UserEntity.php line 17
<?phpnamespace App\Entity;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 Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use App\Repository\UserRepository;/*** @ORM\Entity(repositoryClass=UserRepository::class)* @UniqueEntity(fields={"username"}, message="There is already an account with this username")*/class UserEntity implements UserInterface, PasswordAuthenticatedUserInterface{/*** @ORM\Id* @ORM\GeneratedValue* @ORM\Column(type="integer")*/private ?int $id = null;/*** @ORM\Column(type="string", length=180, unique=true)*/private ?string $username = null;/*** @ORM\Column(type="string", length=180, unique=true)*/private ?string $email = null;/*** @ORM\Column(type="boolean")*/private bool $active = false;/*** @ORM\Column(type="string", length=32, nullable=true)*/private ?string $md5User = null;/*** @ORM\Column(type="json")*/private array $roles = [];/*** @var string The hashed password* @ORM\Column(type="string")*/private ?string $password = null;/*** @ORM\OneToMany(targetEntity=MessageEntity::class, mappedBy="user")*/private $messages;public function __construct(){$this->messages = new ArrayCollection();}public function getMessages(): Collection{return $this->messages;}public function getId(): ?int{return $this->id;}public function getUsername(): ?string{return $this->username;}public function setUsername(string $username): self{$this->username = $username;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}public function getActive(): ?bool{return $this->active;}public function setActive(bool $active): self{$this->active = $active;return $this;}public function getMd5User(): ?string{return $this->md5User;}public function setMd5User(string $md5User): self{$this->md5User = $md5User;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->username;}/*** @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(): void{// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}}