Skip to content

Commit e8011a8

Browse files
author
Roman Glushko
committed
#141 Removed redundant dependency
1 parent 34e0106 commit e8011a8

File tree

1 file changed

+1
-15
lines changed

1 file changed

+1
-15
lines changed

app/code/Magento/QuoteGraphQl/Model/Resolver/Cart/AddSimpleProductsToCart.php

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
use Magento\Framework\Stdlib\ArrayManager;
2020
use Magento\Quote\Api\CartRepositoryInterface;
2121
use Magento\Quote\Api\Data\CartInterface;
22-
use Magento\Quote\Api\GuestCartRepositoryInterface;
2322
use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface;
2423
use Magento\Quote\Model\Quote;
2524
use Magento\QuoteGraphQl\Model\Cart\AddSimpleProductToCartProcessor;
@@ -46,11 +45,6 @@ class AddSimpleProductsToCart implements ResolverInterface
4645
*/
4746
private $maskedQuoteIdToQuoteId;
4847

49-
/**
50-
* @var GuestCartRepositoryInterface
51-
*/
52-
private $guestCartRepository;
53-
5448
/**
5549
* @var CartHydrator
5650
*/
@@ -77,7 +71,6 @@ class AddSimpleProductsToCart implements ResolverInterface
7771
* @param ArrayManager $arrayManager
7872
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
7973
* @param CartRepositoryInterface $cartRepository
80-
* @param GuestCartRepositoryInterface $guestCartRepository
8174
* @param ValueFactory $valueFactory
8275
* @param UserContextInterface $userContext
8376
*/
@@ -87,15 +80,13 @@ public function __construct(
8780
ArrayManager $arrayManager,
8881
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
8982
CartRepositoryInterface $cartRepository,
90-
GuestCartRepositoryInterface $guestCartRepository,
9183
ValueFactory $valueFactory,
9284
UserContextInterface $userContext
9385
) {
9486
$this->valueFactory = $valueFactory;
9587
$this->userContext = $userContext;
9688
$this->arrayManager = $arrayManager;
9789
$this->cartHydrator = $cartHydrator;
98-
$this->guestCartRepository = $guestCartRepository;
9990
$this->cartRepository = $cartRepository;
10091
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
10192
$this->addSimpleProductToCartProcessor = $addSimpleProductToCartProcessor;
@@ -180,13 +171,8 @@ private function getCartErrors($cart): string
180171
*/
181172
private function getCart(string $cartHash): CartInterface
182173
{
183-
$customerId = $this->userContext->getUserId();
184-
185-
if (!$customerId) {
186-
return $this->guestCartRepository->get($cartHash);
187-
}
188-
189174
$cartId = $this->maskedQuoteIdToQuoteId->execute((string) $cartHash);
175+
190176
return $this->cartRepository->get($cartId);
191177
}
192178
}

0 commit comments

Comments
 (0)