class PromotionRepository extends EntityRepository

Class PromotionRepository is injected as alligator.promotion_repository service. PromotionRepository is used for crud operation for managed entity.

Use this class to work with database.

Constants

ALIAS

Alias for promotion

COUPON_ALIAS

Alias for coupon

USER_ALIAS

Alias for user

RULE_ALIAS

Alias for rule

ACTION_ALIAS

Alias for action

Methods

startTransaction()

start db transaction

commitTransaction()

commit db transaction

rollbackTransaction()

rollback db transaction

array
getOneById(int $id)

Find promotion by id

Promotion|null
savePromotion(Promotion $promotion)

Persist new promotion

Promotion|null
editPromotion(Promotion $promotion)

Merge promotion

mixed
findAllForJQGRID(mixed $page, mixed $offset, mixed $sortParams)

Find all promotions with pagination

array
searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false)

Find promotions by search term or count them

bool
removePromotionsFromArray(array $arrayOfPromotions)

Remove promotions provided by array of ids

Promotion|null
findPromotionForAllByCode(string $code, bool $onlyAdjustments)

Find promotion for all users by code

array
findAllPromotionsForFrontend(int $page, int $offset, bool $active, int $userId)

Find all promotions for specific user with pagination

array
countAllPromotionsForFrontend(bool $active, int $userId)

Count all promotions for specific user

Details

at line 69
startTransaction()

start db transaction

at line 77
commitTransaction()

commit db transaction

at line 85
rollbackTransaction()

rollback db transaction

at line 96
array getOneById(int $id)

Find promotion by id

Parameters

int $id

Return Value

array

at line 116
Promotion|null savePromotion(Promotion $promotion)

Persist new promotion

Parameters

Promotion $promotion

Return Value

Promotion|null

at line 138
Promotion|null editPromotion(Promotion $promotion)

Merge promotion

Parameters

Promotion $promotion

Return Value

Promotion|null

at line 162
mixed findAllForJQGRID(mixed $page, mixed $offset, mixed $sortParams)

Find all promotions with pagination

Parameters

mixed $page
mixed $offset
mixed $sortParams

Return Value

mixed

at line 186
array searchForJQGRID(array $searchParams, array $sortParams, bool $isCountSearch = false)

Find promotions by search term or count them

Parameters

array $searchParams
array $sortParams
bool $isCountSearch

Return Value

array

at line 341
bool removePromotionsFromArray(array $arrayOfPromotions)

Remove promotions provided by array of ids

Parameters

array $arrayOfPromotions

Return Value

bool

at line 370
Promotion|null findPromotionForAllByCode(string $code, bool $onlyAdjustments)

Find promotion for all users by code

Parameters

string $code
bool $onlyAdjustments

Return Value

Promotion|null

Exceptions

NonUniqueResultException

at line 392
array findAllPromotionsForFrontend(int $page, int $offset, bool $active, int $userId)

Find all promotions for specific user with pagination

Parameters

int $page
int $offset
bool $active
int $userId

Return Value

array

at line 428
array countAllPromotionsForFrontend(bool $active, int $userId)

Count all promotions for specific user

Parameters

bool $active
int $userId

Return Value

array