CustomerReader

Implements \CustomerReaderInterface

Class CustomerReader

This class is used for reading customer data from the database

category

System

package

Customer

implements

CustomerReaderInterface

Methods

Constructor of the class CustomerReader.

__construct(\AbstractCustomerFactory $customerFactory, \CustomerAddressRepositoryInterface $customerAddressRepository, \CI_DB_query_builder $dbQueryBuilder) 

CrossCuttingLoader dependencies:

  • StringHelper

Arguments

$customerFactory

\AbstractCustomerFactory

Customer factory.

$customerAddressRepository

\CustomerAddressRepositoryInterface

Customer address repository.

$dbQueryBuilder

\CI_DB_query_builder

Query builder.

Creates a customer based on the provided data.

_createCustomerByArray(array $customerDataArray) : \Customer
todo

If date of birth is null in the database then: $customerDataArray['customers_dob'] = '0000-00-00 00:00:00' and then the getDateOfBirth() will return wrong results ($customer->getDateOfBirth() >> -0001-11-30 00:00:00).

Arguments

$customerDataArray

array

Customer data.

Response

\Customer

$customer Created customer.

Helper method which searches for user data based on an applied filter.

_findByFilter(array $filterArray) : \Customer|null

Arguments

$filterArray

array

Filters.

Response

\Customer|null

Customer or null if not found.

Filters customer records and returns an array with results.

filterCustomers(array $conditions = array(), integer $limit = null, integer $offset = null) : array

Example: $reader->filterCustomers( array('customers_id' => 1) );

Arguments

$conditions

array

Associative array containing the desired field and value.

$limit

integer

MySQL limit index.

$offset

integer

Number of records to be returned.

Response

array

Returns an array that contains customer objects.

Finds a customer by the given ID.

findById(\IdType $id) : \Customer|null

Arguments

$id

\IdType

Customer's ID.

Response

\Customer|null

Customer or null if not found.

Finds a guest by email address.

findGuestByEmail(\CustomerEmailInterface $email) : \Customer|null

Arguments

$email

\CustomerEmailInterface

Customer's E-Mail address.

Response

\Customer|null

Customer or null if not found.

Finds a registree by email address.

findRegistreeByEmail(\CustomerEmailInterface $email) : \Customer|null

Arguments

$email

\CustomerEmailInterface

Customer's E-Mail address.

Response

\Customer|null

Customer or null if not found.

Filters customer records and returns the total count.

getFilterCustomersCount(array $conditions = array()) : integer

Example: $reader->filterCustomers( array('customers_id' => 1) );

Arguments

$conditions

array

Associative array containing the desired field and value.

Response

integer

Returns the total customers count.

Filters customer records by a given CustomerSearchCondition object and returns an array with results.

searchCustomers(\CustomerSearchCondition $condition, \Pager $pager) : array

Arguments

$condition

\CustomerSearchCondition

Conditions object for search.

$pager

\Pager

Pager object with page settings to split the results into several pages.

Response

array

Returns an array that contains customer objects.

Properties

Query builder.

db : \CI_DB_query_builder
var

Type(s)

\CI_DB_query_builder

Customer factory.

customerFactory : \AbstractCustomerFactory

Customer address repository.

customerAddressRepository : \CustomerAddressRepositoryInterface

String helper.

stringHelper : \StringHelperInterface

Is customer a guest?

isGuest : boolean
var

Type(s)

boolean