#42: allow updates to menuitems
All checks were successful
/ ls (pull_request) Successful in 37s
/ ls (push) Successful in 39s
/ ls (release) Successful in 25s

This commit is contained in:
lubiana 2024-07-29 13:04:57 +02:00
parent 0068654885
commit 674adcba60
No known key found for this signature in database
14 changed files with 258 additions and 7 deletions

View file

@ -3,6 +3,7 @@
namespace App\Entity;
use App\Repository\MenuItemRepository;
use DateTimeImmutable;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Bridge\Doctrine\IdGenerator\UlidGenerator;
use Symfony\Bridge\Doctrine\Types\UlidType;
@ -24,6 +25,9 @@ class MenuItem
#[ORM\JoinColumn(nullable: false)]
private FoodVendor|null $foodVendor = null;
#[ORM\Column(nullable: true)]
private DateTimeImmutable|null $deletedAt = null;
public function getId(): Ulid|null
{
return $this->id;
@ -52,4 +56,27 @@ class MenuItem
return $this;
}
public function isDeleted(): bool
{
return $this->getDeletedAt() instanceof DateTimeImmutable;
}
public function delete(): static
{
$this->setDeletedAt();
return $this;
}
public function getDeletedAt(): DateTimeImmutable|null
{
return $this->deletedAt;
}
public function setDeletedAt(DateTimeImmutable|null $deletedAt = new DateTimeImmutable): static
{
$this->deletedAt = $deletedAt;
return $this;
}
}