CustomerReadService
in package
implements
CustomerReadServiceInterface
Class CustomerReadService
This class provides methods for reading customer data.
Tags
Interfaces, Classes and Traits
- CustomerReadServiceInterface
- Interface CustomerReadServiceInterface
Table of Contents
- $customerRepository : CustomerRepositoryInterface
- Customer repository.
- __construct() : mixed
- Constructor of the class CustomerService.
- addressIsDefaultCustomerAddress() : bool
- Checks if address is the default address of the customer.
- filterCustomers() : array<string|int, mixed>
- Filters customer records and returns an array with results.
- findCustomerByEmail() : Customer|null
- Finds a customer by its email address. Returns null if no customer is found.
- getCustomerById() : Customer
- Finds a customer by an entered ID.
- getFilterCustomersCount() : int
- Filters customer records and returns the total count.
- registreeEmailExists() : bool
- Checks if the email address of the registree already exists.
- searchCustomers() : array<string|int, mixed>
- Filters customer records by a given CustomerSearchCondition object and returns an array with results.
Properties
$customerRepository
Customer repository.
protected
CustomerRepositoryInterface
$customerRepository
Methods
__construct()
Constructor of the class CustomerService.
public
__construct(CustomerRepositoryInterface $customerRepository) : mixed
Parameters
- $customerRepository : CustomerRepositoryInterface
-
Customer repository.
Return values
mixed —addressIsDefaultCustomerAddress()
Checks if address is the default address of the customer.
public
addressIsDefaultCustomerAddress(CustomerAddressInterface $customerAddress) : bool
Parameters
- $customerAddress : CustomerAddressInterface
-
Customer's address.
Return values
bool —Is provided address the customer's default address?
filterCustomers()
Filters customer records and returns an array with results.
public
filterCustomers([array<string|int, mixed> $conditions = [] ][, Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : array<string|int, mixed>
Example: $service->filterCustomers(['customers_id' => 1]);
Parameters
- $conditions : array<string|int, mixed> = []
-
Associative array containing the desired field and value.
- $pager : Pager|null = null
-
(Optional) Pager object with pagination information
- $sorters : array<string|int, mixed> = []
-
(Optional) array of Sorter objects with data sorting information
Return values
array<string|int, mixed> —Returns an array that contains customer objects.
findCustomerByEmail()
Finds a customer by its email address. Returns null if no customer is found.
public
findCustomerByEmail(CustomerEmailInterface $emailAddress) : Customer|null
Parameters
- $emailAddress : CustomerEmailInterface
Return values
Customer|null —getCustomerById()
Finds a customer by an entered ID.
public
getCustomerById(IdType $customerId) : Customer
Parameters
- $customerId : IdType
-
Customer ID.
Return values
Customer —Customer.
getFilterCustomersCount()
Filters customer records and returns the total count.
public
getFilterCustomersCount([array<string|int, mixed> $conditions = [] ]) : int
Example: $service->filterCustomers(['customers_id' => 1]);
Parameters
- $conditions : array<string|int, mixed> = []
-
Associative array containing the desired field and value.
Return values
int —registreeEmailExists()
Checks if the email address of the registree already exists.
public
registreeEmailExists(CustomerEmailInterface $email) : bool
Parameters
- $email : CustomerEmailInterface
-
Customer's E-Mail address.
Return values
bool —Does the E-Mail address already exist?
searchCustomers()
Filters customer records by a given CustomerSearchCondition object and returns an array with results.
public
searchCustomers(CustomerSearchCondition $condition[, Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : array<string|int, mixed>
Parameters
- $condition : CustomerSearchCondition
-
Conditions object for search.
- $pager : Pager|null = null
-
(Optional) Pager object with pagination information
- $sorters : array<string|int, mixed> = []
-
(Optional) array of Sorter objects with data sorting information
Return values
array<string|int, mixed> —Returns an array that contains customer objects.