class CouponRepository extends EntityRepository

Class CouponRepository is injected as alligator.coupon_repository service. CouponRepository is used for crud operation for managed entity.

Use this class to work with database.

Constants

ALIAS

Alias for coupon

PROMOTION_ALIAS

Alias for promotion

RULE_ALIAS

Alias for rule

ACTION_ALIAS

Alias for action

Methods

null|Coupon
findCouponByCode(string $code, User $user)

Find coupon by code

array
getAllCouponsForUser(int $userId)

Find all coupons for user by id

array
getAllCouponsCountForUser(int $userId)

Count all active coupons for user by id

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

Find all coupons for user with pagination

array
countAllCouponsForFrontend(bool $active, int $userId)

Count all coupons for user. If $active is TRUE then count only active coupons

Coupon|null
findCouponByPK(int $id)

Find coupon by id

updateCoupon(Coupon $coupon)

Merge coupon

Details

at line 70
null|Coupon findCouponByCode(string $code, User $user)

Find coupon by code

Parameters

string $code
User $user

Return Value

null|Coupon

Exceptions

NonUniqueResultException

at line 93
array getAllCouponsForUser(int $userId)

Find all coupons for user by id

Parameters

int $userId

Return Value

array

at line 115
array getAllCouponsCountForUser(int $userId)

Count all active coupons for user by id

Parameters

int $userId

Return Value

array

at line 141
array findAllCouponsForFrontend(int $page, int $offset, bool $active, int $userId)

Find all coupons for user with pagination

Parameters

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

Return Value

array

at line 176
array countAllCouponsForFrontend(bool $active, int $userId)

Count all coupons for user. If $active is TRUE then count only active coupons

Parameters

bool $active
int $userId

Return Value

array

at line 197
Coupon|null findCouponByPK(int $id)

Find coupon by id

Parameters

int $id

Return Value

Coupon|null

at line 208
Coupon updateCoupon(Coupon $coupon)

Merge coupon

Parameters

Coupon $coupon

Return Value

Coupon