TIDE/backend/app/Post/Post.php
Yisroel Baum f73e5a1af5
extend Post entity with feature slot
Adds nullable feature_slot column (unique) plus repo
findByFeatureSlot/findFeatured/update methods so admins can
pin a post into one of two slots.
2026-05-06 22:28:45 +03:00

52 lines
904 B
PHP

<?php
namespace App\Post;
use DateTimeImmutable;
class Post
{
public function __construct(
private int $id,
private int $userId,
private string $title,
private string $body,
private DateTimeImmutable $createdAt,
private ?int $featureSlot,
) {}
public function getId(): int
{
return $this->id;
}
public function getUserId(): int
{
return $this->userId;
}
public function getTitle(): string
{
return $this->title;
}
public function getBody(): string
{
return $this->body;
}
public function getCreatedAt(): DateTimeImmutable
{
return $this->createdAt;
}
public function getFeatureSlot(): ?int
{
return $this->featureSlot;
}
public function isFeatured(): bool
{
return $this->featureSlot !== null;
}
}