User holds email (EmailAddress vo), passwordHash, isAdmin - tide keeps password and admin flag on the user row directly (no separate profile entity like youngstartup). UserRepository exposes find, findByEmail, create. CreateUserDto is readonly with explicit isAdmin (per shared.md no-default-args rule).
35 lines
592 B
PHP
35 lines
592 B
PHP
<?php
|
|
|
|
namespace App\User;
|
|
|
|
use App\Shared\ValueObject\EmailAddress;
|
|
|
|
class User
|
|
{
|
|
public function __construct(
|
|
private int $id,
|
|
private EmailAddress $email,
|
|
private string $passwordHash,
|
|
private bool $isAdmin,
|
|
) {}
|
|
|
|
public function getId(): int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getEmail(): EmailAddress
|
|
{
|
|
return $this->email;
|
|
}
|
|
|
|
public function getPasswordHash(): string
|
|
{
|
|
return $this->passwordHash;
|
|
}
|
|
|
|
public function isAdmin(): bool
|
|
{
|
|
return $this->isAdmin;
|
|
}
|
|
}
|