CustomerRepositoryInterface.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. *
  4. * Copyright © Magento, Inc. All rights reserved.
  5. * See COPYING.txt for license details.
  6. */
  7. namespace Magento\Customer\Api;
  8. /**
  9. * Customer CRUD interface.
  10. * @api
  11. * @since 100.0.2
  12. */
  13. interface CustomerRepositoryInterface
  14. {
  15. /**
  16. * Create or update a customer.
  17. *
  18. * @param \Magento\Customer\Api\Data\CustomerInterface $customer
  19. * @param string $passwordHash
  20. * @return \Magento\Customer\Api\Data\CustomerInterface
  21. * @throws \Magento\Framework\Exception\InputException If bad input is provided
  22. * @throws \Magento\Framework\Exception\State\InputMismatchException If the provided email is already used
  23. * @throws \Magento\Framework\Exception\LocalizedException
  24. */
  25. public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $passwordHash = null);
  26. /**
  27. * Retrieve customer.
  28. *
  29. * @param string $email
  30. * @param int|null $websiteId
  31. * @return \Magento\Customer\Api\Data\CustomerInterface
  32. * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified email does not exist.
  33. * @throws \Magento\Framework\Exception\LocalizedException
  34. */
  35. public function get($email, $websiteId = null);
  36. /**
  37. * Get customer by Customer ID.
  38. *
  39. * @param int $customerId
  40. * @return \Magento\Customer\Api\Data\CustomerInterface
  41. * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified ID does not exist.
  42. * @throws \Magento\Framework\Exception\LocalizedException
  43. */
  44. public function getById($customerId);
  45. /**
  46. * Retrieve customers which match a specified criteria.
  47. *
  48. * This call returns an array of objects, but detailed information about each object’s attributes might not be
  49. * included. See https://devdocs.magento.com/codelinks/attributes.html#CustomerRepositoryInterface to determine
  50. * which call to use to get detailed information about all attributes for an object.
  51. *
  52. * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
  53. * @return \Magento\Customer\Api\Data\CustomerSearchResultsInterface
  54. * @throws \Magento\Framework\Exception\LocalizedException
  55. */
  56. public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
  57. /**
  58. * Delete customer.
  59. *
  60. * @param \Magento\Customer\Api\Data\CustomerInterface $customer
  61. * @return bool true on success
  62. * @throws \Magento\Framework\Exception\LocalizedException
  63. */
  64. public function delete(\Magento\Customer\Api\Data\CustomerInterface $customer);
  65. /**
  66. * Delete customer by Customer ID.
  67. *
  68. * @param int $customerId
  69. * @return bool true on success
  70. * @throws \Magento\Framework\Exception\NoSuchEntityException
  71. * @throws \Magento\Framework\Exception\LocalizedException
  72. */
  73. public function deleteById($customerId);
  74. }