125 lines
2.3 KiB
PHP
125 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\UserRepository;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
use Symfony\Component\Security\Core\User\UserInterface;
|
|
use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
|
|
|
|
#[ORM\Entity(repositoryClass: UserRepository::class)]
|
|
class User implements UserInterface, PasswordAuthenticatedUserInterface
|
|
{
|
|
/**
|
|
* @var int|null
|
|
*/
|
|
#[ORM\Id()]
|
|
#[ORM\GeneratedValue(strategy: "AUTO")]
|
|
#[ORM\Column(type: "integer")]
|
|
private ?int $id;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
#[ORM\Column(type: "string", length: 100)]
|
|
private string $email;
|
|
|
|
/**
|
|
* @var string
|
|
*/
|
|
#[ORM\Column(type: "string", length: 60)]
|
|
private string $password;
|
|
|
|
/**
|
|
* @var bool
|
|
*/
|
|
#[ORM\Column(type: "boolean")]
|
|
private bool $sendmail;
|
|
|
|
/**
|
|
* @return int|null
|
|
*/
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
/**
|
|
* @param int|null $id
|
|
* @return User
|
|
*/
|
|
public function setId(?int $id): User
|
|
{
|
|
$this->id = $id;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getEmail(): string
|
|
{
|
|
return $this->email;
|
|
}
|
|
|
|
/**
|
|
* @param string $email
|
|
* @return User
|
|
*/
|
|
public function setEmail(string $email): User
|
|
{
|
|
$this->email = $email;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return string
|
|
*/
|
|
public function getPassword(): string
|
|
{
|
|
return $this->password;
|
|
}
|
|
|
|
/**
|
|
* @param string $password
|
|
* @return User
|
|
*/
|
|
public function setPassword(string $password): User
|
|
{
|
|
$this->password = $password;
|
|
return $this;
|
|
}
|
|
|
|
/**
|
|
* @return bool
|
|
*/
|
|
public function isSendmail(): bool
|
|
{
|
|
return $this->sendmail;
|
|
}
|
|
|
|
/**
|
|
* @param bool $sendmail
|
|
* @return User
|
|
*/
|
|
public function setSendmail(bool $sendmail): User
|
|
{
|
|
$this->sendmail = $sendmail;
|
|
return $this;
|
|
}
|
|
|
|
public function getRoles(): array
|
|
{
|
|
return array_unique(['ROLE_USER']);
|
|
}
|
|
|
|
public function eraseCredentials()
|
|
{
|
|
// TODO: Implement eraseCredentials() method.
|
|
}
|
|
|
|
public function getUserIdentifier(): string
|
|
{
|
|
return (string) $this->email;
|
|
}
|
|
} |