AddressBookService
in package
implements
AddressBookServiceInterface
Class AddressBookService
This class is used to manage addresses
Tags
Interfaces, Classes and Traits
- AddressBookServiceInterface
- Interface AddressBookServiceInterface
Table of Contents
- $customerAddressRepository : CustomerAddressRepositoryInterface
- __construct() : mixed
- Constructor of the class AddressBookService
- createNewAddress() : CustomerAddressInterface
- Method to add a new address in the address book
- deleteAddress() : mixed
- Method to delete an address from the address book
- filterAddresses() : array<string|int, mixed>
- Filter registered addresses by string.
- findAddressById() : CustomerAddress|null
- getAllAddresses() : array<string|int, mixed>
- Get all registered addresses.
- getCustomerAddresses() : array<string|int, mixed>
- Get customer addresses.
- updateAddress() : CustomerAddressInterface
- Method to update an address in the address book
- updateCustomerAddress() : mixed
Properties
$customerAddressRepository
protected
CustomerAddressRepositoryInterface
$customerAddressRepository
Methods
__construct()
Constructor of the class AddressBookService
public
__construct(CustomerAddressRepositoryInterface $addressRepository) : mixed
Parameters
- $addressRepository : CustomerAddressRepositoryInterface
Return values
mixed —createNewAddress()
Method to add a new address in the address book
public
createNewAddress(AddressBlockInterface $addressBlock, CustomerInterface $customer) : CustomerAddressInterface
Parameters
- $addressBlock : AddressBlockInterface
- $customer : CustomerInterface
Return values
CustomerAddressInterface —deleteAddress()
Method to delete an address from the address book
public
deleteAddress(CustomerAddressInterface $address) : mixed
Parameters
- $address : CustomerAddressInterface
Return values
mixed —filterAddresses()
Filter registered addresses by string.
public
filterAddresses(string $p_keyword[, Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : array<string|int, mixed>
Parameters
- $p_keyword : string
-
Used to filter the address records.
- $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 of CustomerAddress objects.
findAddressById()
public
findAddressById(IdType $addressId) : CustomerAddress|null
Parameters
- $addressId : IdType
Return values
CustomerAddress|null —getAllAddresses()
Get all registered addresses.
public
getAllAddresses([Pager|null $pager = null ][, array<string|int, mixed> $sorters = [] ]) : array<string|int, mixed>
Parameters
- $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 of CustomerAddress objects.
getCustomerAddresses()
Get customer addresses.
public
getCustomerAddresses(CustomerInterface $customer) : array<string|int, mixed>
Parameters
- $customer : CustomerInterface
-
Contains the customer data.
Return values
array<string|int, mixed> —Returns an array of CustomerAddress objects.
updateAddress()
Method to update an address in the address book
public
updateAddress(AddressBlockInterface $addressBlock, CustomerAddressInterface $address) : CustomerAddressInterface
Parameters
- $addressBlock : AddressBlockInterface
- $address : CustomerAddressInterface
Return values
CustomerAddressInterface —updateCustomerAddress()
public
updateCustomerAddress(CustomerAddressInterface $customerAddress) : mixed
Parameters
- $customerAddress : CustomerAddressInterface