Files
Starseed/src/Module/Core/Application/DTO/UserOutput.php
Matthieu 180bc5c556 fix : fix UserOutput type and use UserRepositoryInterface in CreateUserCommand
Change UserOutput.id from int to ?int to match User::getId() return type.
Replace EntityManagerInterface with UserRepositoryInterface in CreateUserCommand.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-09 14:16:14 +02:00

30 lines
650 B
PHP

<?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(),
);
}
}