Add display_name (unique) and email_confirmed_at columns plus matching getters, DTO fields, repo methods (findByDisplayName, update), and migration. Existing auth tests updated to construct User with the new params.
53 lines
1,021 B
PHP
53 lines
1,021 B
PHP
<?php
|
|
|
|
namespace App\User;
|
|
|
|
use App\Shared\ValueObject\EmailAddress;
|
|
use DateTimeImmutable;
|
|
|
|
class User
|
|
{
|
|
public function __construct(
|
|
private int $id,
|
|
private EmailAddress $email,
|
|
private string $displayName,
|
|
private string $passwordHash,
|
|
private bool $isAdmin,
|
|
private ?DateTimeImmutable $emailConfirmedAt,
|
|
) {}
|
|
|
|
public function getId(): int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getEmail(): EmailAddress
|
|
{
|
|
return $this->email;
|
|
}
|
|
|
|
public function getDisplayName(): string
|
|
{
|
|
return $this->displayName;
|
|
}
|
|
|
|
public function getPasswordHash(): string
|
|
{
|
|
return $this->passwordHash;
|
|
}
|
|
|
|
public function isAdmin(): bool
|
|
{
|
|
return $this->isAdmin;
|
|
}
|
|
|
|
public function getEmailConfirmedAt(): ?DateTimeImmutable
|
|
{
|
|
return $this->emailConfirmedAt;
|
|
}
|
|
|
|
public function isEmailConfirmed(): bool
|
|
{
|
|
return $this->emailConfirmedAt !== null;
|
|
}
|
|
}
|