Post: id, userId (fk -> User), title, body, createdAt as DateTimeImmutable. CreatePostDto readonly with explicit createdAt (use case supplies it via Clock; entity remains pure). PostRepository: create, find, findByUserId, findRecent (limit), delete.
15 lines
259 B
PHP
15 lines
259 B
PHP
<?php
|
|
|
|
namespace App\Post;
|
|
|
|
use DateTimeImmutable;
|
|
|
|
readonly class CreatePostDto
|
|
{
|
|
public function __construct(
|
|
public int $userId,
|
|
public string $title,
|
|
public string $body,
|
|
public DateTimeImmutable $createdAt,
|
|
) {}
|
|
}
|