From 9327d5fc41ac720fa416368c88ab3d4a9cd3dde7 Mon Sep 17 00:00:00 2001 From: creme332 <65414576+creme332@users.noreply.github.com> Date: Mon, 20 May 2024 10:42:03 +0400 Subject: [PATCH] use empty() to check if there are no errors with line item --- src/models/Order.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/models/Order.php b/src/models/Order.php index 9b389a1..9c92240 100644 --- a/src/models/Order.php +++ b/src/models/Order.php @@ -121,7 +121,7 @@ public function save(): bool $update_stock_stm = $conn->prepare($query); foreach ($this->line_items as $line_item) { - if (!$line_item->validate()) { + if (!empty($line_item->validate())) { // line item contains invalid attributes $conn->rollBack(); $conn = null; @@ -191,6 +191,7 @@ public function save(): bool * * @param OrderProduct $orderProduct * @return void + * @throws Exception */ public function addLineItem(OrderProduct $orderProduct): void {