CustomerCountryZoneReader
in package
implements
CustomerCountryZoneReaderInterface
Class CustomerCountryZoneReader
This class is used for reading customer country zone data from the database
Tags
Interfaces, Classes and Traits
- CustomerCountryZoneReaderInterface
- Interface CustomerCountryZoneReaderInterface
Table of Contents
- $customerFactory : AbstractCustomerFactory
- $db : CI_DB_query_builder
- __construct() : mixed
- Constructor of the class CustomerCountryZoneReader
- findById() : CustomerCountryZone
- Method to find a country zone with a given ID if it exists else it will return null
- findByName() : CustomerCountryZone
- Method to find a country zone with a given name if it exists else it will return null
- findByNameAndCountry() : CustomerCountryZone|null
- findCountryZoneByZoneCodeAndCountry() : CustomerCountryZoneInterface|null
- Returns an array with country zone data.
- findCountryZoneByZoneCodeAndCountryId() : CustomerCountryZoneInterface|null
- Returns an array with country zone data.
- findCountryZonesByCountryId() : array<string|int, mixed>
- Method to find a country zone with a given country ID if it exists else it will return an empty array
- _createCountryZoneByArray() : CustomerCountryZone
- Creates a customer country zone object from the given zone data.
- _getZoneDataByZoneCodeAndCountryId() : array<string|int, mixed>
- Fetches data for a zone by the given zone code and country id.
Properties
$customerFactory
protected
AbstractCustomerFactory
$customerFactory
$db
protected
CI_DB_query_builder
$db
Methods
__construct()
Constructor of the class CustomerCountryZoneReader
public
__construct(AbstractCustomerFactory $customerFactory, CI_DB_query_builder $dbQueryBuilder) : mixed
Parameters
- $customerFactory : AbstractCustomerFactory
- $dbQueryBuilder : CI_DB_query_builder
Return values
mixed —findById()
Method to find a country zone with a given ID if it exists else it will return null
public
findById(IdType $countryZoneId) : CustomerCountryZone
Parameters
- $countryZoneId : IdType
Return values
CustomerCountryZone —findByName()
Method to find a country zone with a given name if it exists else it will return null
public
findByName(CustomerCountryZoneNameInterface $countryZoneName) : CustomerCountryZone
Parameters
- $countryZoneName : CustomerCountryZoneNameInterface
Return values
CustomerCountryZone —findByNameAndCountry()
public
findByNameAndCountry(CustomerCountryZoneNameInterface $countryZoneName, CustomerCountryInterface $country) : CustomerCountryZone|null
Parameters
- $countryZoneName : CustomerCountryZoneNameInterface
- $country : CustomerCountryInterface
Return values
CustomerCountryZone|null —findCountryZoneByZoneCodeAndCountry()
Returns an array with country zone data.
public
findCountryZoneByZoneCodeAndCountry(CustomerCountryZoneIsoCodeInterface $zoneCode, CustomerCountryInterface $country) : CustomerCountryZoneInterface|null
An empty array will be returned if no results are found.
Parameters
- $zoneCode : CustomerCountryZoneIsoCodeInterface
-
Zone code of expected country zone.
- $country : CustomerCountryInterface
-
Country of zone.
Return values
CustomerCountryZoneInterface|null —Country zone.
findCountryZoneByZoneCodeAndCountryId()
Returns an array with country zone data.
public
findCountryZoneByZoneCodeAndCountryId(CustomerCountryZoneIsoCodeInterface $zoneCode, IdType $countryId) : CustomerCountryZoneInterface|null
An empty array will be returned if no results are found.
Parameters
- $zoneCode : CustomerCountryZoneIsoCodeInterface
-
Zone code of expected country zone.
- $countryId : IdType
-
Country id of zone.
Return values
CustomerCountryZoneInterface|null —Country zone.
findCountryZonesByCountryId()
Method to find a country zone with a given country ID if it exists else it will return an empty array
public
findCountryZonesByCountryId(IdType $countryId) : array<string|int, mixed>
Parameters
- $countryId : IdType
Return values
array<string|int, mixed> —of CustomerCountryZone objects
_createCountryZoneByArray()
Creates a customer country zone object from the given zone data.
protected
_createCountryZoneByArray(array<string|int, mixed> $zoneDataArray) : CustomerCountryZone
Parameters
- $zoneDataArray : array<string|int, mixed>
-
Zone data, must contain keys "zone_id", "zone_name" and "zone_code".
Return values
CustomerCountryZone —_getZoneDataByZoneCodeAndCountryId()
Fetches data for a zone by the given zone code and country id.
protected
_getZoneDataByZoneCodeAndCountryId(string $zoneCode, int $countryId) : array<string|int, mixed>
Parameters
- $zoneCode : string
-
ISO code of expected zone.
- $countryId : int
-
Id of zone's country.
Return values
array<string|int, mixed> —Data for a zone.