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.
This commit is contained in:
parent
64a334c63e
commit
f73e5a1af5
6 changed files with 160 additions and 4 deletions
|
|
@ -12,6 +12,7 @@ class Post
|
|||
private string $title,
|
||||
private string $body,
|
||||
private DateTimeImmutable $createdAt,
|
||||
private ?int $featureSlot,
|
||||
) {}
|
||||
|
||||
public function getId(): int
|
||||
|
|
@ -38,4 +39,14 @@ class Post
|
|||
{
|
||||
return $this->createdAt;
|
||||
}
|
||||
|
||||
public function getFeatureSlot(): ?int
|
||||
{
|
||||
return $this->featureSlot;
|
||||
}
|
||||
|
||||
public function isFeatured(): bool
|
||||
{
|
||||
return $this->featureSlot !== null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue