CustomerReader

Extends \AbstractDataPaginator Implements \CustomerReaderInterface

Class CustomerReader

This class is used for reading customer data from the database

category

System

package

Customer

implements

CustomerReaderInterface

Methods

ManufacturerReader constructor.

__construct(\CI_DB_query_builder $query_builder) 
inherited

Arguments

$query_builder

\CI_DB_query_builder

Applies the class default sorting

_applyDefaultSorting() 
inherited abstract

Applies a pagination (Limit and Offset) clause to the currently building query.

_applyPagination(\Pager|null $pager = null) : $this|\ProductListProvider
inherited

Arguments

$pager

\Pager|null

(Optional) Pager object with pagination information

Response

$this|\ProductListProvider

Same instance for chained method calls.

Applies a sorting based on sorter param (if sorting is supplied) or apply default sorting.

_applySorting(array $sorters = array()) : $this|\ProductListProvider
inherited
Throws
\InvalidArgumentException

if some element of the $sorters array is not a instance of Sorter object

Arguments

$sorters

array

Array of Sorter objects.

Response

$this|\ProductListProvider

Same instance for chained method calls.

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.

return the child class Field Map array.

_getFieldMap() : \array.
inherited abstract

Response

\array.

Parse an order by sql query into a array with fieldname and direction.

_parseOrderByString(\StringType|null $orderBy = null) : array
inherited

Arguments

$orderBy

\StringType|null

SQL order by String

Response

array

with sort information structured as ['field'=>'', 'direction'=>''].

Translate an order by sql instruction into a array of Sorter

_translateOrderByStringIntoArrayOfSorter(\StringType|null $orderBy = null) : array
inherited

Arguments

$orderBy

\StringType|null

SQL instruction with fields to sort.

Response

array

of Sorter objects.

Return the related database field of a given object(Entity) field.

_translateToDatabaseField(\string $fieldName) : \string.
inherited
Throws
\InvalidArgumentException

if the provided field name is not a valid mapped field

Arguments

$fieldName

\string

Object Field name.

Response

\string.

Parse an order by sql query into a array with fieldname and direction.

_translateToJsonFieldName(\StringType $databaseFieldName) : string|FALSE
inherited

Arguments

$databaseFieldName

\StringType

the database field name. It can be supplied as table.fieldName or fieldName.

Response

string|FALSE

will return the field name or FALSE if the field doesn't exist.

Filters customer records and returns an array with results.

filterCustomers(array $conditions = array(), \Pager|null $pager = null, array $sorters = array()) : array

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

Arguments

$conditions

array

Associative array containing the desired field and value.

$pager

\Pager|null

(Optional) Pager object with pagination information

$sorters

array

(Optional) array of Sorter objects with data sorting information

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|null $pager = null, array $sorters = array()) : array

Arguments

$condition

\CustomerSearchCondition

Conditions object for search.

$pager

\Pager|null

(Optional) Pager object with pagination information

$sorters

array

(Optional) array of Sorter objects with data sorting information

Response

array

Returns an array that contains customer objects.

Properties

Customer factory.

customerFactory : \AbstractCustomerFactory

Customer address repository.

customerAddressRepository : \CustomerAddressRepositoryInterface

String helper.

stringHelper : \StringHelperInterface

Is customer a guest?

isGuest : boolean
var

Type(s)

boolean

db

db : \\CI_DB_query_builder
inherited
var

Type(s)

\\CI_DB_query_builder