Skip to content

Commit

Permalink
Bugfix Pricing Rules -> #214
Browse files Browse the repository at this point in the history
  • Loading branch information
ctippler committed Nov 22, 2024
1 parent 5caac82 commit 8806162
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/PricingManager/Rule/Dao.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,19 @@ public function getById(int $id): void
*/
public function create(): void
{
$this->db->insert(self::TABLE_NAME, []);
$this->model->setId((int) $this->db->lastInsertId());
try {
$this->db->beginTransaction();
if (!$this->model->getId()) {
$this->create();
}

$this->update();
$this->db->commit();
} catch (\Exception $e) {
$this->db->rollBack();

throw $e;
}
}

/**
Expand Down

0 comments on commit 8806162

Please sign in to comment.