CustomerService
in package
implements
CustomerServiceInterface
Class CustomerService
This class provides methods for creating and deleting customer data
Tags
Interfaces, Classes and Traits
- CustomerServiceInterface
- Interface CustomerServiceInterface
Table of Contents
- $customerReadService : CustomerReadServiceInterface
- Customer read service.
- $customerWriteService : CustomerWriteServiceInterface
- Customer write service.
- __construct() : mixed
- Constructor of the class CustomerService.
- addressIsDefaultCustomerAddress() : bool
- Checks if address is the default address of the customer.
- createNewCustomer() : Customer
- Creates a new customer with the given parameters.
- createNewGuest() : Customer
- Creates a new guest account with the given parameters.
- deleteCustomerById() : mixed
- Deletes the customer by its ID.
- filterCustomers() : array<string|int, mixed>
- Filters customer records and returns an array with results.
- getCustomerById() : Customer
- Finds a customer by its ID.
- registreeEmailExists() : bool
- Checks if the email address of the registree already exists.
- updateCustomer() : CustomerInterface
- Updates customer data.
Properties
$customerReadService
Customer read service.
protected
CustomerReadServiceInterface
$customerReadService
$customerWriteService
Customer write service.
protected
CustomerWriteServiceInterface
$customerWriteService
Methods
__construct()
Constructor of the class CustomerService.
public
__construct(CustomerReadServiceInterface $customerReadService, CustomerWriteServiceInterface $customerWriteService) : mixed
Parameters
- $customerReadService : CustomerReadServiceInterface
-
Customer read service.
- $customerWriteService : CustomerWriteServiceInterface
-
Customer write service.
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 the provided address the customer's default address?
createNewCustomer()
Creates a new customer with the given parameters.
public
createNewCustomer(CustomerEmailInterface $email, CustomerPasswordInterface $password, DateTime $dateOfBirth, CustomerVatNumberInterface $vatNumber, CustomerCallNumberInterface $telephoneNumber, CustomerCallNumberInterface $faxNumber, AddressBlockInterface $addressBlock, KeyValueCollection $addonValues[, CustomerNumberInterface|null $customerNumber = null ]) : Customer
Parameters
- $email : CustomerEmailInterface
-
Customer's E-Mail address.
- $password : CustomerPasswordInterface
-
Customer's password.
- $dateOfBirth : DateTime
-
Customer's date of birth.
- $vatNumber : CustomerVatNumberInterface
-
Customer's VAT number.
- $telephoneNumber : CustomerCallNumberInterface
-
Customer's telephone number.
- $faxNumber : CustomerCallNumberInterface
-
Customer's fax number.
- $addressBlock : AddressBlockInterface
-
Customer's address.
- $addonValues : KeyValueCollection
-
Customer's additional values.
- $customerNumber : CustomerNumberInterface|null = null
-
Customer's number.
Tags
Return values
Customer —Created customer.
createNewGuest()
Creates a new guest account with the given parameters.
public
createNewGuest(CustomerEmailInterface $email, DateTime $dateOfBirth, CustomerVatNumberInterface $vatNumber, CustomerCallNumberInterface $telephoneNumber, CustomerCallNumberInterface $faxNumber, AddressBlockInterface $addressBlock, KeyValueCollection $addonValues[, CustomerNumberInterface|null $customerNumber = null ]) : Customer
Parameters
- $email : CustomerEmailInterface
-
Customer's E-Mail address.
- $dateOfBirth : DateTime
-
Customer's date of birth.
- $vatNumber : CustomerVatNumberInterface
-
Customer's VAT number.
- $telephoneNumber : CustomerCallNumberInterface
-
Customer's telephone number.
- $faxNumber : CustomerCallNumberInterface
-
Customer's fax number.
- $addressBlock : AddressBlockInterface
-
Customer's address.
- $addonValues : KeyValueCollection
-
Customer's additional values.
- $customerNumber : CustomerNumberInterface|null = null
-
Customer's number.
Tags
Return values
Customer —Created guest customer.
deleteCustomerById()
Deletes the customer by its ID.
public
deleteCustomerById(IdType $customerId) : mixed
Parameters
- $customerId : IdType
-
Customer's ID.
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: $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.
getCustomerById()
Finds a customer by its ID.
public
getCustomerById(IdType $customerId) : Customer
Parameters
- $customerId : IdType
-
Customer's ID.
Return values
Customer —Customer.
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 provided E-Mail address already exist?
updateCustomer()
Updates customer data.
public
updateCustomer(CustomerInterface $customer) : CustomerInterface
Parameters
- $customer : CustomerInterface
-
Customer.
Return values
CustomerInterface —Updated customer.