class DefaultMysql implements IProductList (View source)

Implementation of product list which works based on the product index of the online shop framework

Properties

protected null|IIndexable[] $products
protected string $tenantName
protected IMysqlConfig $tenantConfig
protected null|int $totalCount
protected string $variantMode
protected int $limit
protected int $offset
protected AbstractCategory $category
protected Dao $resource
protected bool $inProductList
protected Logger $logger
protected string[] $conditions
protected string[] $relationConditions
protected string[][] $queryConditions
protected float $conditionPriceFrom
protected float $conditionPriceTo
protected $order
protected string $orderKey
protected $orderByPrice

Methods

__construct(IMysqlConfig $tenantConfig)

No description

getProducts()

No description

addCondition(string $condition, string $fieldname = '')

No description

mixed
resetCondition($fieldname)

Reset filter condition for fieldname

addRelationCondition(string $fieldname, string $condition)

No description

resetConditions()

resets all conditions of product list

addQueryCondition($condition, string $fieldname = '')

Adds query condition to product list for fulltext search Fieldname is optional but highly recommended - needed for resetting condition based on fieldname and exclude functionality in group by results

mixed
resetQueryCondition($fieldname)

Reset query condition for fieldname

addPriceCondition(null|float $from = null, null|float $to = null)

No description

void
setInProductList(bool $inProductList)

No description

bool
getInProductList()

No description

void
setOrder($order)

sets order direction

string
getOrder()

gets order direction

void
setOrderKey($orderKey)

No description

string
getOrderKey()

No description

void
setLimit($limit)

No description

int
getLimit()

No description

void
setOffset($offset)

No description

int
getOffset()

No description

void
setCategory(AbstractCategory $category)

No description

getCategory()

No description

void
setVariantMode($variantMode)

No description

string
getVariantMode()

No description

load()

loads search results from index and returns them

array
loadWithoutPriceFilterWithoutPriceSorting()

First case: no price filtering and no price sorting

array
loadWithoutPriceFilterWithPriceSorting()

Second case: no price filtering but price sorting

array
loadWithPriceFilterWithoutPriceSorting()

Third case: price filtering but no price sorting

array
loadWithPriceFilterWithPriceSorting()

Forth case: price filtering and price sorting

loadElementById($elementId)

loads element by id

void
prepareGroupByValues(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

prepares all group by values for given field names and cache them in local variable considers both - normal values and relation values

void
resetPreparedGroupByValues()

resets all set prepared group by values

void
prepareGroupByRelationValues(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

prepares all group by values for given field names and cache them in local variable considers both - normal values and relation values

void
prepareGroupBySystemValues(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

prepares all group by values for given field names and cache them in local variable considers both - normal values and relation values

array
getGroupBySystemValues($fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

loads group by values based on relation fieldname either from local variable if prepared or directly from product index

array
getGroupByValues($fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

No description

array
getGroupByRelationValues($fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

No description

buildQueryFromConditions($excludeConditions = false, $excludedFieldname = null, $variantMode = null)

No description

buildUserspecificConditions($excludedFieldname = null)

No description

buildOrderBy()

No description

quote($value)

No description

string
buildSimularityOrderBy($fields, $objectId)

returns order by statement for simularity calculations based on given fields and object ids returns cosine simularity calculation

string
buildFulltextSearchWhere($fields, $searchstring)

returns where statement for fulltext search index

int
count()

(PHP 5 >= 5.1.0)
Count elements of an object

mixed
current()

(PHP 5 >= 5.1.0)
Return the current element

array
getItems(int $offset, int $itemCountPerPage)

Returns an collection of items for a page.

AdapterInterface
getPaginatorAdapter()

Return a fully configured Paginator Adapter from this method.

scalar
key()

(PHP 5 >= 5.1.0)
Return the key of the current element

void
next()

(PHP 5 >= 5.1.0)
Move forward to next element

void
rewind()

(PHP 5 >= 5.1.0)
Rewind the Iterator to the first element

bool
valid()

(PHP 5 >= 5.1.0)
Checks if current position is valid

array
__sleep()

No description

__wakeup()

No description

string
getCacheIdentifier()

this is needed for ZF1 Paginator

Details

__construct(IMysqlConfig $tenantConfig)

Parameters

IMysqlConfig $tenantConfig

IIndexable[] getProducts()

Return Value

IIndexable[]

addCondition(string $condition, string $fieldname = '')

Parameters

string $condition
string $fieldname

mixed resetCondition($fieldname)

Reset filter condition for fieldname

Parameters

$fieldname

Return Value

mixed

addRelationCondition(string $fieldname, string $condition)

Parameters

string $fieldname
string $condition

resetConditions()

resets all conditions of product list

addQueryCondition($condition, string $fieldname = '')

Adds query condition to product list for fulltext search Fieldname is optional but highly recommended - needed for resetting condition based on fieldname and exclude functionality in group by results

Parameters

$condition
string $fieldname

mixed resetQueryCondition($fieldname)

Reset query condition for fieldname

Parameters

$fieldname

Return Value

mixed

addPriceCondition(null|float $from = null, null|float $to = null)

Parameters

null|float $from
null|float $to

void setInProductList(bool $inProductList)

Parameters

bool $inProductList

Return Value

void

bool getInProductList()

Return Value

bool

void setOrder($order)

sets order direction

Parameters

$order

Return Value

void

string getOrder()

gets order direction

Return Value

string

void setOrderKey($orderKey)

Parameters

$orderKey string | array - either single field name, or array of field names or array of arrays (field name, direction)

Return Value

void

string getOrderKey()

Return Value

string | array

void setLimit($limit)

Parameters

$limit int

Return Value

void

int getLimit()

Return Value

int

void setOffset($offset)

Parameters

$offset int

Return Value

void

int getOffset()

Return Value

int

void setCategory(AbstractCategory $category)

Parameters

AbstractCategory $category

Return Value

void

AbstractCategory getCategory()

Return Value

AbstractCategory

void setVariantMode($variantMode)

Parameters

$variantMode

Return Value

void

string getVariantMode()

Return Value

string

IIndexable[] load()

loads search results from index and returns them

Return Value

IIndexable[]

protected array loadWithoutPriceFilterWithoutPriceSorting()

First case: no price filtering and no price sorting

Return Value

array

protected array loadWithoutPriceFilterWithPriceSorting()

Second case: no price filtering but price sorting

Return Value

array

Exceptions

Exception

protected array loadWithPriceFilterWithoutPriceSorting()

Third case: price filtering but no price sorting

Return Value

array

Exceptions

Exception

protected array loadWithPriceFilterWithPriceSorting()

Forth case: price filtering and price sorting

Return Value

array

Exceptions

Exception

protected array|AbstractObject loadElementById($elementId)

loads element by id

Parameters

$elementId

Return Value

array|AbstractObject

void prepareGroupByValues(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

prepares all group by values for given field names and cache them in local variable considers both - normal values and relation values

Parameters

string $fieldname
bool $countValues
bool $fieldnameShouldBeExcluded

Return Value

void

void resetPreparedGroupByValues()

resets all set prepared group by values

Return Value

void

void prepareGroupByRelationValues(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

prepares all group by values for given field names and cache them in local variable considers both - normal values and relation values

Parameters

string $fieldname
bool $countValues
bool $fieldnameShouldBeExcluded

Return Value

void

void prepareGroupBySystemValues(string $fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

prepares all group by values for given field names and cache them in local variable considers both - normal values and relation values

Parameters

string $fieldname
bool $countValues
bool $fieldnameShouldBeExcluded

Return Value

void

array getGroupBySystemValues($fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

loads group by values based on relation fieldname either from local variable if prepared or directly from product index

Parameters

$fieldname
bool $countValues
bool $fieldnameShouldBeExcluded => set to false for and-conditions

Return Value

array

Exceptions

Exception

array getGroupByValues($fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

Parameters

$fieldname
bool $countValues
bool $fieldnameShouldBeExcluded => set to false for and-conditions

Return Value

array

Exceptions

Exception

array getGroupByRelationValues($fieldname, bool $countValues = false, bool $fieldnameShouldBeExcluded = true)

Parameters

$fieldname
bool $countValues
bool $fieldnameShouldBeExcluded => set to false for and-conditions

Return Value

array

Exceptions

Exception

protected buildQueryFromConditions($excludeConditions = false, $excludedFieldname = null, $variantMode = null)

Parameters

$excludeConditions
$excludedFieldname
$variantMode

protected buildUserspecificConditions($excludedFieldname = null)

Parameters

$excludedFieldname

protected buildOrderBy()

quote($value)

Parameters

$value

IMysqlConfig getCurrentTenantConfig()

Return Value

IMysqlConfig

string buildSimularityOrderBy($fields, $objectId)

returns order by statement for simularity calculations based on given fields and object ids returns cosine simularity calculation

Parameters

$fields
$objectId

Return Value

string

string buildFulltextSearchWhere($fields, $searchstring)

returns where statement for fulltext search index

Parameters

$fields
$searchstring

Return Value

string

int count()

(PHP 5 >= 5.1.0)
Count elements of an object

Return Value

int The custom count as an integer.

<

p> The return value is cast to an integer.

mixed current()

(PHP 5 >= 5.1.0)
Return the current element

Return Value

mixed Can return any type.

array getItems(int $offset, int $itemCountPerPage)

Returns an collection of items for a page.

Parameters

int $offset Page offset
int $itemCountPerPage Number of items per page

Return Value

array

AdapterInterface getPaginatorAdapter()

Return a fully configured Paginator Adapter from this method.

Return Value

AdapterInterface

scalar key()

(PHP 5 >= 5.1.0)
Return the key of the current element

Return Value

scalar scalar on success, integer 0 on failure.

void next()

(PHP 5 >= 5.1.0)
Move forward to next element

Return Value

void Any returned value is ignored.

void rewind()

(PHP 5 >= 5.1.0)
Rewind the Iterator to the first element

Return Value

void Any returned value is ignored.

bool valid()

(PHP 5 >= 5.1.0)
Checks if current position is valid

Return Value

bool The return value will be casted to boolean and then evaluated. Returns true on success or false on failure.

array __sleep()

Return Value

array

__wakeup()

string getCacheIdentifier()

this is needed for ZF1 Paginator

Return Value

string