I think we can divide Repository interfaces into multiple interfaces.so Extension providers don't need to provide implementation for all methods in interfaces.
interface CustomerRepositorySaveInterface
{
/**
* Create or update a customer.
*
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @param string $passwordHash
* @return \Magento\Customer\Api\Data\CustomerInterface
* @throws \Magento\Framework\Exception\InputException If bad input is provided
* @throws \Magento\Framework\Exception\State\InputMismatchException If the provided email is already used
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function save(\Magento\Customer\Api\Data\CustomerInterface $customer, $passwordHash = null);
}
interface CustomerRepositoryGetInterface
{
/**
* Retrieve customer.
*
* @param string $email
* @param int|null $websiteId
* @return \Magento\Customer\Api\Data\CustomerInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified email does not exist.
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function get($email, $websiteId = null);
/**
* Get customer by customer ID.
*
* @param int $customerId
* @return \Magento\Customer\Api\Data\CustomerInterface
* @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified ID does not exist.
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getById($customerId);
/**
* Retrieve customers which match a specified criteria.
*
* This call returns an array of objects, but detailed information about each object’s attributes might not be
* included. See http://devdocs.magento.com/codelinks/attributes.html#CustomerRepositoryInterface to determine
* which call to use to get detailed information about all attributes for an object.
*
* @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
* @return \Magento\Customer\Api\Data\CustomerSearchResultsInterface
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getList(\Magento\Framework\Api\SearchCriteriaInterface $searchCriteria);
}
interface CustomerRepositoryDeleteInterface
{
/**
* Delete customer.
*
* @param \Magento\Customer\Api\Data\CustomerInterface $customer
* @return bool true on success
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function delete(\Magento\Customer\Api\Data\CustomerInterface $customer);
/**
* Delete customer by ID.
*
* @param int $customerId
* @return bool true on success
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function deleteById($customerId);
}
class CustomerRepository implements \Magento\Customer\Api\CustomerRepositorySaveInterface,\Magento\Customer\Api\CustomerRepositoryGetInterface,\Magento\Customer\Api\CustomerRepositoryDeleteInterface
{
}