@@ -299,18 +299,46 @@ private function populateCustomerWithSecureData($customerModel, $passwordHash =
299
299
}
300
300
}
301
301
302
+ /**
303
+ * Retrieve customer.
304
+ *
305
+ * @param string $email
306
+ * @param int|null $websiteId
307
+ * @return \Magento\Customer\Api\Data\CustomerInterface
308
+ * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified email does not exist.
309
+ * @throws \Magento\Framework\Exception\LocalizedException
310
+ */
302
311
public function get ($ email , $ websiteId = null )
303
312
{
304
313
$ customerModel = $ this ->customerRegistry ->retrieveByEmail ($ email , $ websiteId );
305
314
return $ customerModel ->getDataModel ();
306
315
}
307
316
317
+ /**
318
+ * Get customer by Customer ID.
319
+ *
320
+ * @param int $customerId
321
+ * @return \Magento\Customer\Api\Data\CustomerInterface
322
+ * @throws \Magento\Framework\Exception\NoSuchEntityException If customer with the specified ID does not exist.
323
+ * @throws \Magento\Framework\Exception\LocalizedException
324
+ */
308
325
public function getById ($ customerId )
309
326
{
310
327
$ customerModel = $ this ->customerRegistry ->retrieve ($ customerId );
311
328
return $ customerModel ->getDataModel ();
312
329
}
313
330
331
+ /**
332
+ * Retrieve customers which match a specified criteria.
333
+ *
334
+ * This call returns an array of objects, but detailed information about each object’s attributes might not be
335
+ * included. See http://devdocs.magento.com/codelinks/attributes.html#CustomerRepositoryInterface to determine
336
+ * which call to use to get detailed information about all attributes for an object.
337
+ *
338
+ * @param \Magento\Framework\Api\SearchCriteriaInterface $searchCriteria
339
+ * @return \Magento\Customer\Api\Data\CustomerSearchResultsInterface
340
+ * @throws \Magento\Framework\Exception\LocalizedException
341
+ */
314
342
public function getList (SearchCriteriaInterface $ searchCriteria )
315
343
{
316
344
$ searchResults = $ this ->searchResultsFactory ->create ();
@@ -348,11 +376,26 @@ public function getList(SearchCriteriaInterface $searchCriteria)
348
376
return $ searchResults ;
349
377
}
350
378
379
+ /**
380
+ * Delete customer.
381
+ *
382
+ * @param \Magento\Customer\Api\Data\CustomerInterface $customer
383
+ * @return bool true on success
384
+ * @throws \Magento\Framework\Exception\LocalizedException
385
+ */
351
386
public function delete (CustomerInterface $ customer )
352
387
{
353
388
return $ this ->deleteById ($ customer ->getId ());
354
389
}
355
390
391
+ /**
392
+ * Delete customer by Customer ID.
393
+ *
394
+ * @param int $customerId
395
+ * @return bool true on success
396
+ * @throws \Magento\Framework\Exception\NoSuchEntityException
397
+ * @throws \Magento\Framework\Exception\LocalizedException
398
+ */
356
399
public function deleteById ($ customerId )
357
400
{
358
401
$ customerModel = $ this ->customerRegistry ->retrieve ($ customerId );
0 commit comments