class BuyXRepository extends EntityRepository implements AbstractBlockElementRepositoryInterface

Class BuyXRepository is injected as empire_buy_x_get_y_plugin.buy_x_repository service. BuyXRepository is used for crud operation for managed entity.

Use this class to work with database.

Traits

Trait JQGridTrait

Constants

BUY_X_GET_Y_BLOCKS_RESULT_CACHE

Key for caching buy x get y offer

ALIAS

Alias for buy x

Y_ALIAS

Alias for get y

BUY_X_QUANTITY_ALIAS

Alias for buy x quantity

PRODUCT_ALIAS

Alias for buy x product

PRODUCT_Y_ALIAS

Alias for get y product

SIMPLE_PRODUCT_Y_ALIAS

Alias for simple product

Methods

jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

array
findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

save(BuyX $entity)

Persist new buy x offer

edit(BuyX $entity)

Merge bux x offer

bool
removeFromArray(array $array)

Remove buy x offers provided by array

mixed
getOfferForEdit(int $id)

Find bux offer by id

array
getAllOffersForFrontEnd()

Find all buy x offers

array
getOfferForProductPage(int $id)

Find buy x offer by id

array
getProductsForDiscount(int $id)

Find all buy x and get y products for provided id

getReference(int $id)

Find reference on buy x

array
getEntitiesForBlockElementsExtension(array $ids)

Get entities from database by ids Tis method is used to for block elements extension Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.$this->getAlias().'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field Also make sure you cache this data -> qb->useQueryCache(true)->useResultCache(true, 3600)

array
getEntityNamesForIds(array $ids)

Get id and name (field must be name so change it in select) of entity Used in event for block element edit Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.$this->getAlias().'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field

bool|Proxy|null|object
getReferenceForClass(string $class, int $id)

Find reference on entity by its class and id

deleteResultCaches()

Delete all cached results

Details

in JQGridTrait at line 27
jQGridJoinFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

All joins used in select.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 42
jQGridGroupByFields(QueryBuilder $qb, JQGridWrapper $jqGridWrapper)

Should contain group by which jqgrid uses.

Override in the repository class if needed. Should do nothing otherwise

Parameters

QueryBuilder $qb
JQGridWrapper $jqGridWrapper

in JQGridTrait at line 61
array findAllForJQGRID(int $page, int $offset, array $sortParams, array $additionalParams, JQGridWrapper $jqGridWrapper)

JQGrid function

Parameters

int $page
int $offset
array $sortParams
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

in JQGridTrait at line 94
array searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false, array $additionalParams = array(), JQGridWrapper $jqGridWrapper = null)

JQGrid function

Parameters

array $searchParams
array $sortParams
bool $isCountSearch
array $additionalParams
JQGridWrapper $jqGridWrapper

Return Value

array

at line 91
BuyX save(BuyX $entity)

Persist new buy x offer

Parameters

BuyX $entity

Return Value

BuyX

at line 112
BuyX edit(BuyX $entity)

Merge bux x offer

Parameters

BuyX $entity

Return Value

BuyX

at line 130
bool removeFromArray(array $array)

Remove buy x offers provided by array

Parameters

array $array

Return Value

bool

at line 161
mixed getOfferForEdit(int $id)

Find bux offer by id

Parameters

int $id

Return Value

mixed

Exceptions

NoResultException
NonUniqueResultException

See also

BuyX
BuyXQuantity
GetY

at line 187
array getAllOffersForFrontEnd()

Find all buy x offers

Return Value

array

at line 218
array getOfferForProductPage(int $id)

Find buy x offer by id

Parameters

int $id

Return Value

array

at line 255
array getProductsForDiscount(int $id)

Find all buy x and get y products for provided id

Parameters

int $id

Return Value

array

at line 279
BuyX getReference(int $id)

Find reference on buy x

Parameters

int $id

Return Value

BuyX

Exceptions

ORMException

at line 287
array getEntitiesForBlockElementsExtension(array $ids)

Get entities from database by ids Tis method is used to for block elements extension Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.$this->getAlias().'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field Also make sure you cache this data -> qb->useQueryCache(true)->useResultCache(true, 3600)

Parameters

array $ids

Return Value

array

at line 315
array getEntityNamesForIds(array $ids)

Get id and name (field must be name so change it in select) of entity Used in event for block element edit Make sure you order data by ids - ids is array of elements and it is sorted by priority - so add this to select -> ' FIELD('.$this->getAlias().'.id'.', '.implode(', ', $ids).') AS sort_col'); - and order by this field

Parameters

array $ids

Return Value

array

at line 339
bool|Proxy|null|object getReferenceForClass(string $class, int $id)

Find reference on entity by its class and id

Parameters

string $class
int $id

Return Value

bool|Proxy|null|object

Exceptions

ORMException

at line 347
deleteResultCaches()

Delete all cached results