CustomerRepository
in package
implements
CustomerRepositoryInterface
Class CustomerRepository
This class contains basic methods for finding, creating and deleting customer data
Tags
Interfaces, Classes and Traits
- CustomerRepositoryInterface
- Interface CustomerRepositoryInterface
Table of Contents
- $addonValueService : AddonValueServiceInterface
- $customerAddressRepository : CustomerAddressRepositoryInterface
- Customer address repository.
- $customerDeleter : CustomerDeleterInterface
- Customer deleter.
- $customerFactory : AbstractCustomerFactory
- Customer factory.
- $customerReader : CustomerReaderInterface
- Customer reader.
- $customerWriter : CustomerWriterInterface
- Customer writer.
- __construct() : mixed
- Constructor of the class CustomerRepository.
- deleteCustomerById() : mixed
- Deletes the customer by the ID.
- deleteGuestByEmail() : mixed
- Deletes a guest account by its email address.
- filterCustomers() : array<string|int, mixed>
- Filters customer records and returns an array with results.
- getCustomerById() : CustomerInterface
- Finds customer data by an ID.
- getFilterCustomersCount() : int
- Filters customer records and returns the total count.
- getGuestByEmail() : Customer|null
- Returns a guest account by its email address.
- getNewCustomer() : Customer
- Creates a new customer.
- getRegistreeByEmail() : Customer|null
- Finds a registered customer based on the e-mail address.
- searchCustomers() : array<string|int, mixed>
- Filters customer records by a given CustomerSearchCondition object and returns an array with results.
- store() : mixed
- Stores customer data in the database.
Properties
$addonValueService
protected
AddonValueServiceInterface
$addonValueService
$customerAddressRepository
Customer address repository.
protected
CustomerAddressRepositoryInterface
$customerAddressRepository
$customerDeleter
Customer deleter.
protected
CustomerDeleterInterface
$customerDeleter
$customerFactory
Customer factory.
protected
AbstractCustomerFactory
$customerFactory
$customerReader
Customer reader.
protected
CustomerReaderInterface
$customerReader
$customerWriter
Customer writer.
protected
CustomerWriterInterface
$customerWriter
Methods
__construct()
Constructor of the class CustomerRepository.
public
__construct(CustomerWriterInterface $customerWriter, CustomerReaderInterface $customerReader, CustomerDeleterInterface $customerDeleter, CustomerAddressRepositoryInterface $customerAddressRepository, AbstractCustomerFactory $customerFactory, AddonValueServiceInterface $addonValueService) : mixed
Parameters
- $customerWriter : CustomerWriterInterface
-
Customer writer.
- $customerReader : CustomerReaderInterface
-
Customer reader.
- $customerDeleter : CustomerDeleterInterface
-
Customer deleter.
- $customerAddressRepository : CustomerAddressRepositoryInterface
-
Customer address repository.
- $customerFactory : AbstractCustomerFactory
-
Customer factory.
- $addonValueService : AddonValueServiceInterface
-
Service to handle customer addon values.
Return values
mixed —deleteCustomerById()
Deletes the customer by the ID.
public
deleteCustomerById(IdType $customerId) : mixed
Parameters
- $customerId : IdType
-
Customer's ID.
Return values
mixed —deleteGuestByEmail()
Deletes a guest account by its email address.
public
deleteGuestByEmail(CustomerEmailInterface $email) : mixed
Parameters
- $email : CustomerEmailInterface
-
Guest customer's E-Mail address.
Return values
mixed —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: $repository->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.
getCustomerById()
Finds customer data by an ID.
public
getCustomerById(IdType $customerId) : CustomerInterface
Parameters
- $customerId : IdType
-
Customer's ID.
Tags
Return values
CustomerInterface —getFilterCustomersCount()
Filters customer records and returns the total count.
public
getFilterCustomersCount([array<string|int, mixed> $conditions = [] ]) : int
Example: $repository->filterCustomers('customers_id' => 1);
Parameters
- $conditions : array<string|int, mixed> = []
-
Associative array containing the desired field and value.
Return values
int —getGuestByEmail()
Returns a guest account by its email address.
public
getGuestByEmail(CustomerEmailInterface $email) : Customer|null
Parameters
- $email : CustomerEmailInterface
-
Guest customer's E-Mail address.
Return values
Customer|null —Customer or null if not found.
getNewCustomer()
Creates a new customer.
public
getNewCustomer() : Customer
Return values
Customer —Newly created customer.
getRegistreeByEmail()
Finds a registered customer based on the e-mail address.
public
getRegistreeByEmail(CustomerEmailInterface $email) : Customer|null
Parameters
- $email : CustomerEmailInterface
-
Customer's E-Mail address.
Return values
Customer|null —Customer or null if not found.
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.
store()
Stores customer data in the database.
public
store(CustomerInterface $customer) : mixed
Parameters
- $customer : CustomerInterface
-
Customer.