ProductLinkManagementInterface.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Bundle\Api;
  8. /**
  9. * Interface for Management of ProductLink
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface ProductLinkManagementInterface
  14. {
  15. /**
  16. * Get all children for Bundle product
  17. *
  18. * @param string $productSku
  19. * @param int $optionId
  20. * @return \Magento\Bundle\Api\Data\LinkInterface[]
  21. * @throws \Magento\Framework\Exception\NoSuchEntityException
  22. * @throws \Magento\Framework\Exception\InputException
  23. */
  24. public function getChildren($productSku, $optionId = null);
  25. /**
  26. * Add child product to specified Bundle option by product sku
  27. *
  28. * @param string $sku
  29. * @param int $optionId
  30. * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
  31. * @throws \Magento\Framework\Exception\NoSuchEntityException
  32. * @throws \Magento\Framework\Exception\CouldNotSaveException
  33. * @throws \Magento\Framework\Exception\InputException
  34. * @return int
  35. */
  36. public function addChildByProductSku($sku, $optionId, \Magento\Bundle\Api\Data\LinkInterface $linkedProduct);
  37. /**
  38. * @param string $sku
  39. * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
  40. * @throws \Magento\Framework\Exception\NoSuchEntityException
  41. * @throws \Magento\Framework\Exception\CouldNotSaveException
  42. * @throws \Magento\Framework\Exception\InputException
  43. * @return bool
  44. */
  45. public function saveChild(
  46. $sku,
  47. \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
  48. );
  49. /**
  50. * @param \Magento\Catalog\Api\Data\ProductInterface $product
  51. * @param int $optionId
  52. * @param \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
  53. * @throws \Magento\Framework\Exception\NoSuchEntityException
  54. * @throws \Magento\Framework\Exception\CouldNotSaveException
  55. * @throws \Magento\Framework\Exception\InputException
  56. * @return int
  57. */
  58. public function addChild(
  59. \Magento\Catalog\Api\Data\ProductInterface $product,
  60. $optionId,
  61. \Magento\Bundle\Api\Data\LinkInterface $linkedProduct
  62. );
  63. /**
  64. * Remove product from Bundle product option
  65. *
  66. * @param string $sku
  67. * @param int $optionId
  68. * @param string $childSku
  69. * @throws \Magento\Framework\Exception\NoSuchEntityException
  70. * @throws \Magento\Framework\Exception\InputException
  71. * @return bool
  72. */
  73. public function removeChild($sku, $optionId, $childSku);
  74. }