Skip to content

Commit

Permalink
Bugfix(PricingRules): Prevent Error when adding a new Pricing Rule wi…
Browse files Browse the repository at this point in the history
…th a name that exists

When you create a Pricing Rule with an name that already exists the backend interface is not loading the pricing rules anymore because it inserts a row with "null" values.

The reason is because the create() call is successfully but at the update() call you get an errror because a pricing Rule with that name already exists. Solution -> wrap it into a transaction
  • Loading branch information
ctippler committed Nov 22, 2024
1 parent 4bcd78d commit 54bcde0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/PricingManager/Rule/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function getById(int $id): void
public function create(): void
{
$this->db->insert(self::TABLE_NAME, []);
$this->model->setId((int)$this->db->lastInsertId());
$this->model->setId((int) $this->db->lastInsertId());
}

/**
Expand Down

0 comments on commit 54bcde0

Please sign in to comment.