Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
GuestCartRepository.php
Go to the documentation of this file.
1 <?php
9 
13 use Magento\Quote\Model\QuoteIdMaskFactory;
14 
19 {
23  protected $repository;
24 
29 
34  public function __construct(
36  QuoteIdMaskFactory $quoteIdMaskFactory
37  ) {
38  $this->repository = $repository;
39  $this->quoteIdMaskFactory = $quoteIdMaskFactory;
40  }
41 
45  public function get($cartId)
46  {
48  $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
49  return $this->repository->get($quoteIdMask->getQuoteId());
50  }
51 
55  public function save($cartId, MessageInterface $giftMessage)
56  {
58  $quoteIdMask = $this->quoteIdMaskFactory->create()->load($cartId, 'masked_id');
59  return $this->repository->save($quoteIdMask->getQuoteId(), $giftMessage);
60  }
61 }
save($cartId, \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage)
$giftMessage
Definition: items.phtml:47
__construct(CartRepository $repository, QuoteIdMaskFactory $quoteIdMaskFactory)
$cartId
Definition: quote.php:22