cartManagement = $cartManagement; $this->guestCartManagement = $guestCartManagement; $this->quoteIdToMaskedId = $quoteIdToMaskedId; $this->quoteIdMaskFactory = $quoteIdMaskFactory; } /** * @inheritdoc */ public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null) { $customerId = $context->getUserId(); if (0 !== $customerId && null !== $customerId) { $quoteId = $this->cartManagement->createEmptyCartForCustomer($customerId); $maskedQuoteId = $this->quoteIdToMaskedId->execute((int)$quoteId); if (empty($maskedQuoteId)) { $quoteIdMask = $this->quoteIdMaskFactory->create(); $quoteIdMask->setQuoteId($quoteId)->save(); $maskedQuoteId = $quoteIdMask->getMaskedId(); } } else { $maskedQuoteId = $this->guestCartManagement->createEmptyCart(); } return $maskedQuoteId; } }