ItemRepositoryInterface.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\GiftMessage\Api;
  7. /**
  8. * Interface ItemRepositoryInterface
  9. * @api
  10. * @since 100.0.2
  11. */
  12. interface ItemRepositoryInterface
  13. {
  14. /**
  15. * Return the gift message for a specified item in a specified shopping cart.
  16. *
  17. * @param int $cartId The shopping cart ID.
  18. * @param int $itemId The item ID.
  19. * @return \Magento\GiftMessage\Api\Data\MessageInterface Gift message.
  20. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified item does not exist in the cart.
  21. */
  22. public function get($cartId, $itemId);
  23. /**
  24. * Set the gift message for a specified item in a specified shopping cart.
  25. *
  26. * @param int $cartId The cart ID.
  27. * @param \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage The gift message.
  28. * @param int $itemId The item ID.
  29. * @return bool
  30. * @throws \Magento\Framework\Exception\NoSuchEntityException The specified cart does not exist.
  31. * @throws \Magento\Framework\Exception\InputException You cannot add gift messages to empty carts.
  32. * @throws \Magento\Framework\Exception\State\InvalidTransitionException You cannot add gift messages to
  33. * virtual products.
  34. * @throws \Magento\Framework\Exception\CouldNotSaveException The specified gift message could not be saved.
  35. */
  36. public function save($cartId, \Magento\GiftMessage\Api\Data\MessageInterface $giftMessage, $itemId);
  37. }