Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
#141 Removed redundant dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
Roman Glushko committed Sep 19, 2018
1 parent 34e0106 commit e8011a8
Showing 1 changed file with 1 addition and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
use Magento\Framework\Stdlib\ArrayManager;
use Magento\Quote\Api\CartRepositoryInterface;
use Magento\Quote\Api\Data\CartInterface;
use Magento\Quote\Api\GuestCartRepositoryInterface;
use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface;
use Magento\Quote\Model\Quote;
use Magento\QuoteGraphQl\Model\Cart\AddSimpleProductToCartProcessor;
Expand All @@ -46,11 +45,6 @@ class AddSimpleProductsToCart implements ResolverInterface
*/
private $maskedQuoteIdToQuoteId;

/**
* @var GuestCartRepositoryInterface
*/
private $guestCartRepository;

/**
* @var CartHydrator
*/
Expand All @@ -77,7 +71,6 @@ class AddSimpleProductsToCart implements ResolverInterface
* @param ArrayManager $arrayManager
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
* @param CartRepositoryInterface $cartRepository
* @param GuestCartRepositoryInterface $guestCartRepository
* @param ValueFactory $valueFactory
* @param UserContextInterface $userContext
*/
Expand All @@ -87,15 +80,13 @@ public function __construct(
ArrayManager $arrayManager,
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
CartRepositoryInterface $cartRepository,
GuestCartRepositoryInterface $guestCartRepository,
ValueFactory $valueFactory,
UserContextInterface $userContext
) {
$this->valueFactory = $valueFactory;
$this->userContext = $userContext;
$this->arrayManager = $arrayManager;
$this->cartHydrator = $cartHydrator;
$this->guestCartRepository = $guestCartRepository;
$this->cartRepository = $cartRepository;
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
$this->addSimpleProductToCartProcessor = $addSimpleProductToCartProcessor;
Expand Down Expand Up @@ -180,13 +171,8 @@ private function getCartErrors($cart): string
*/
private function getCart(string $cartHash): CartInterface
{
$customerId = $this->userContext->getUserId();

if (!$customerId) {
return $this->guestCartRepository->get($cartHash);
}

$cartId = $this->maskedQuoteIdToQuoteId->execute((string) $cartHash);

return $this->cartRepository->get($cartId);
}
}

0 comments on commit e8011a8

Please sign in to comment.