feat : mise à jour de la structure du projet
This commit is contained in:
29
src/Module/Core/Application/DTO/UserOutput.php
Normal file
29
src/Module/Core/Application/DTO/UserOutput.php
Normal file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Module\Core\Application\DTO;
|
||||
|
||||
use App\Module\Core\Domain\Entity\User;
|
||||
use DateTimeImmutable;
|
||||
|
||||
final readonly class UserOutput
|
||||
{
|
||||
public function __construct(
|
||||
public int $id,
|
||||
public string $username,
|
||||
/** @var list<string> */
|
||||
public array $roles,
|
||||
public ?DateTimeImmutable $createdAt,
|
||||
) {}
|
||||
|
||||
public static function fromEntity(User $user): self
|
||||
{
|
||||
return new self(
|
||||
id: $user->getId(),
|
||||
username: $user->getUsername(),
|
||||
roles: $user->getRoles(),
|
||||
createdAt: $user->getCreatedAt(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user