Skip to content

Commit

Permalink
use empty() to check if there are no errors with line item
Browse files Browse the repository at this point in the history
  • Loading branch information
creme332 committed May 20, 2024
1 parent 809bb3c commit 9327d5f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/models/Order.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -191,6 +191,7 @@ public function save(): bool
*
* @param OrderProduct $orderProduct
* @return void
* @throws Exception
*/
public function addLineItem(OrderProduct $orderProduct): void
{
Expand Down

0 comments on commit 9327d5f

Please sign in to comment.