From 0ab52b127b9273db7e64022fa745ceeb49edfe5d Mon Sep 17 00:00:00 2001 From: ctippler Date: Fri, 29 Nov 2024 09:32:25 +0100 Subject: [PATCH] Bugfix(PricingRules): Prevent Error when adding a new Pricing Rule with a name that exists (#216) * Bugfix Pricing Rules -> https://github.com/pimcore/ecommerce-framework-bundle/pull/214 * Revert "Bugfix Pricing Rules -> https://github.com/pimcore/ecommerce-framework-bundle/pull/214" This reverts commit 8806162bb2d5735eb42693073372ab753691994d. * fix copy paste error * Update src/PricingManager/Rule/Dao.php Co-authored-by: Jacob Dreesen --------- Co-authored-by: Jacob Dreesen --- src/PricingManager/Rule/Dao.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/PricingManager/Rule/Dao.php b/src/PricingManager/Rule/Dao.php index f878a7b0..77b360ba 100644 --- a/src/PricingManager/Rule/Dao.php +++ b/src/PricingManager/Rule/Dao.php @@ -76,11 +76,14 @@ public function create(): void */ public function save(): void { - if (!$this->model->getId()) { - $this->create(); - } + $this->db->transactional(function () { + if (!$this->model->getId()) { + $this->create(); + } + + $this->update(); + }); - $this->update(); } public function update(): void