diff --git a/src/Modifier/OrderGiftCardAmountModifier.php b/src/Modifier/OrderGiftCardAmountModifier.php index c7a2ff53..75faca80 100644 --- a/src/Modifier/OrderGiftCardAmountModifier.php +++ b/src/Modifier/OrderGiftCardAmountModifier.php @@ -4,7 +4,6 @@ namespace Setono\SyliusGiftCardPlugin\Modifier; -use Doctrine\Persistence\ObjectManager; use RuntimeException; use Setono\SyliusGiftCardPlugin\Model\AdjustmentInterface; use Setono\SyliusGiftCardPlugin\Model\GiftCardInterface; @@ -16,13 +15,6 @@ */ final class OrderGiftCardAmountModifier implements OrderGiftCardAmountModifierInterface { - private ObjectManager $giftCardManager; - - public function __construct(ObjectManager $giftCardManager) - { - $this->giftCardManager = $giftCardManager; - } - public function decrement(OrderInterface $order): void { foreach ($order->getAdjustments(AdjustmentInterface::ORDER_GIFT_CARD_ADJUSTMENT) as $adjustment) { @@ -41,8 +33,6 @@ public function decrement(OrderInterface $order): void $giftCard->setAmount($giftCard->getAmount() - $amount); } } - - $this->giftCardManager->flush(); } public function increment(OrderInterface $order): void @@ -56,8 +46,6 @@ public function increment(OrderInterface $order): void $giftCard->enable(); } } - - $this->giftCardManager->flush(); } private static function getGiftCard(OrderInterface $order, string $code): GiftCardInterface diff --git a/src/Resources/config/services/modifier.xml b/src/Resources/config/services/modifier.xml index 5a5d3fe2..681accde 100644 --- a/src/Resources/config/services/modifier.xml +++ b/src/Resources/config/services/modifier.xml @@ -7,8 +7,6 @@ - - + public="true"/>