GroupRepositoryInterface.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Customer\Api;
  7. /**
  8. * Customer group CRUD interface
  9. * @api
  10. * @since 100.0.2
  11. */
  12. interface GroupRepositoryInterface
  13. {
  14. /**
  15. * Save customer group.
  16. *
  17. * @param \Magento\Customer\Api\Data\GroupInterface $group
  18. * @return \Magento\Customer\Api\Data\GroupInterface
  19. * @throws \Magento\Framework\Exception\InputException If there is a problem with the input
  20. * @throws \Magento\Framework\Exception\NoSuchEntityException If a group ID is sent but the group does not exist
  21. * @throws \Magento\Framework\Exception\State\InvalidTransitionException
  22. * If saving customer group with customer group code that is used by an existing customer group
  23. * @throws \Magento\Framework\Exception\LocalizedException
  24. */
  25. public function save(\Magento\Customer\Api\Data\GroupInterface $group);
  26. /**
  27. * Get customer group by group ID.
  28. *
  29. * @param int $id
  30. * @return \Magento\Customer\Api\Data\GroupInterface
  31. * @throws \Magento\Framework\Exception\NoSuchEntityException If $groupId is not found
  32. * @throws \Magento\Framework\Exception\LocalizedException
  33. */
  34. public function getById($id);
  35. /**
  36. * Retrieve customer groups.
  37. *
  38. * The list of groups can be filtered to exclude the NOT_LOGGED_IN group using the first parameter and/or it can
  39. * be filtered by tax class.
  40. *
  41. * This call returns an array of objects, but detailed information about each object’s attributes might not be
  42. * included. See https://devdocs.magento.com/codelinks/attributes.html#GroupRepositoryInterface to determine
  43. * which call to use to get detailed information about all attributes for an object.
  44. *
  45. * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
  46. * @return \Magento\Customer\Api\Data\GroupSearchResultsInterface
  47. * @throws \Magento\Framework\Exception\LocalizedException
  48. */
  49. public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
  50. /**
  51. * Delete customer group.
  52. *
  53. * @param \Magento\Customer\Api\Data\GroupInterface $group
  54. * @return bool true on success
  55. * @throws \Magento\Framework\Exception\StateException If customer group cannot be deleted
  56. * @throws \Magento\Framework\Exception\LocalizedException
  57. */
  58. public function delete(\Magento\Customer\Api\Data\GroupInterface $group);
  59. /**
  60. * Delete customer group by ID.
  61. *
  62. * @param int $id
  63. * @return bool true on success
  64. * @throws \Magento\Framework\Exception\NoSuchEntityException
  65. * @throws \Magento\Framework\Exception\StateException If customer group cannot be deleted
  66. * @throws \Magento\Framework\Exception\LocalizedException
  67. */
  68. public function deleteById($id);
  69. }