#42: allow updates to menuitems
This commit is contained in:
parent
0068654885
commit
674adcba60
14 changed files with 258 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue