Skip to content

Commit

Permalink
NTR: fix container
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitalij Mik committed Sep 2, 2024
1 parent 23b3836 commit d796ffb
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Checkout/Cart/ExpressCartItemAddRoute.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ class ExpressCartItemAddRoute extends AbstractCartItemAddRoute
private $cartItemAddRoute;

/**
* @var CartBackupService
* @var ContainerInterface
*/
private $container;

private $cartBackupService;
/**
* @var CartServiceInterface
*/
Expand All @@ -33,7 +33,7 @@ class ExpressCartItemAddRoute extends AbstractCartItemAddRoute
public function __construct(AbstractCartItemAddRoute $cartItemAddRoute, ContainerInterface $container, CartServiceInterface $cartService)
{
$this->cartItemAddRoute = $cartItemAddRoute;
$this->cartBackupService = $container->get(CartBackupService::class);
$this->container = $container;
$this->cartService = $cartService;
}

Expand All @@ -58,9 +58,9 @@ public function add(Request $request, Cart $cart, SalesChannelContext $context,
if ($isExpressCheckout === false) {
return $this->getDecorated()->add($request, $cart, $context, $items);
}

if (!$this->cartBackupService->isBackupExisting($context)) {
$this->cartBackupService->backupCart($context);
$cartBackupService = $this->container->get(CartBackupService::class); //Shopware 6.4 have circular injection, we have to use contaier
if (!$cartBackupService->isBackupExisting($context)) {
$cartBackupService->backupCart($context);
}

$cart = $this->cartService->getCalculatedMainCart($context);
Expand Down

0 comments on commit d796ffb

Please sign in to comment.