lol
This commit is contained in:
parent
2bdd5f9ac2
commit
15f8db46a0
5 changed files with 51 additions and 12 deletions
|
@ -1,7 +0,0 @@
|
|||
api_platform:
|
||||
title: Hello API Platform
|
||||
version: 1.0.0
|
||||
defaults:
|
||||
stateless: true
|
||||
cache_headers:
|
||||
vary: ['Content-Type', 'Authorization', 'Origin']
|
|
@ -1,4 +0,0 @@
|
|||
api_platform:
|
||||
resource: .
|
||||
type: api_platform
|
||||
prefix: /api
|
|
@ -35,6 +35,11 @@ class MenuItem
|
|||
#[ORM\Column(length: 255)]
|
||||
private string|null $name = null;
|
||||
|
||||
#[ORM\Column(type: 'integer', options: [
|
||||
'default' => 0,
|
||||
])]
|
||||
private int $priceCents = 0;
|
||||
|
||||
public function __construct(
|
||||
#[ORM\Column(type: UlidType::NAME, unique: true)]
|
||||
#[ORM\CustomIdGenerator(class: UlidGenerator::class)]
|
||||
|
@ -95,6 +100,11 @@ class MenuItem
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
public function getPriceCents(): int
|
||||
{
|
||||
return $this->priceCents;
|
||||
}
|
||||
|
||||
public function isDeleted(): bool
|
||||
{
|
||||
return $this->getDeletedAt() instanceof DateTimeImmutable;
|
||||
|
@ -137,4 +147,10 @@ class MenuItem
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPriceCents(int $priceCents): self
|
||||
{
|
||||
$this->priceCents = $priceCents;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,6 +28,12 @@ class OrderItem
|
|||
#[ORM\ManyToOne(inversedBy: 'orderItems')]
|
||||
private FoodOrder|null $foodOrder = null;
|
||||
|
||||
#[Groups('food_order:latest')]
|
||||
#[ORM\Column(type: 'boolean', options: [
|
||||
'default' => false,
|
||||
])]
|
||||
private bool $isPaid = false;
|
||||
|
||||
#[Groups(['food_order:latest'])]
|
||||
#[ORM\JoinColumn(nullable: false)]
|
||||
#[ORM\ManyToOne]
|
||||
|
@ -37,6 +43,12 @@ class OrderItem
|
|||
#[ORM\Column(length: 255)]
|
||||
private string|null $name = null;
|
||||
|
||||
#[Groups('food_order:latest')]
|
||||
#[ORM\Column(type: 'integer', options: [
|
||||
'default' => 0,
|
||||
])]
|
||||
private int $priceCents = 0;
|
||||
|
||||
public function __construct(
|
||||
#[Groups(['food_order:latest'])]
|
||||
#[ORM\Column(type: UlidType::NAME, unique: true)]
|
||||
|
@ -78,6 +90,16 @@ class OrderItem
|
|||
return $this->name;
|
||||
}
|
||||
|
||||
public function getPriceCents(): int
|
||||
{
|
||||
return $this->priceCents;
|
||||
}
|
||||
|
||||
public function isPaid(): bool
|
||||
{
|
||||
return $this->isPaid;
|
||||
}
|
||||
|
||||
public function setCreatedBy(string $createdBy): static
|
||||
{
|
||||
$this->createdBy = $createdBy;
|
||||
|
@ -99,6 +121,12 @@ class OrderItem
|
|||
return $this;
|
||||
}
|
||||
|
||||
public function setIsPaid(bool $isPaid): self
|
||||
{
|
||||
$this->isPaid = $isPaid;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setMenuItem(MenuItem|null $menuItem): static
|
||||
{
|
||||
$this->menuItem = $menuItem;
|
||||
|
@ -113,4 +141,10 @@ class OrderItem
|
|||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function setPriceCents(int $priceCents): self
|
||||
{
|
||||
$this->priceCents = $priceCents;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ describe(OrderItemController::class, function (): void {
|
|||
$this->assertResponseRedirects(sprintf('/food/order/%s', $this->order->getId()));
|
||||
|
||||
$this->assertSame(1, $this->repository->count([]));
|
||||
$this->assertSame(3, $this->menuItemRepository->count([]));
|
||||
$this->assertSame(2, $this->menuItemRepository->count([]));
|
||||
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue