class Promotion implements PromotionInterface

Class Promotion

Properties

protected int $id
protected string|null $name Promotion name
protected string|null $description Promotion description
protected integer|null $priority When exclusive, promotion with top priority will be applied
protected bool|null $exclusive Cannot be applied together with other promotions
protected string $type Promotion type
protected string|null $code Promotion code
protected int|null $usageLimit Maximum number of time promotion can be used
protected bool|null $used Number of times promotion has been used
protected DateTime|null $startsAt Date from which promotion is valid
protected DateTime|null $endsAt Date until which promotion is valid
protected bool|null $couponBased Whether this promotion is triggered by a coupon
protected bool|null $sendByMail Notify users about promotion
protected DateTime|null $updatedAt Date when promotion last updated
protected DateTime|null $createdAt Date when promotion created
protected bool|null $allUsersSelected Promotion valid for all users
protected Collection|CouponInterface[] $coupons List of associated coupons
protected Collection|RuleInterface[] $rules List of associated rules
protected Collection|ActionInterface[] $actions List of associated actions
protected ArrayCollection|Order[] $orders List of orders on which promotion applied

Methods

__construct()

Promotion constructor.

int
getId()

No description

string|null
getName()

Get name

setName(string|null $name)

Set name

string|null
getDescription()

Get description

setDescription(string|null $description)

Set description

int|null
getPriority()

Get priority

setPriority(int|null $priority)

Set priority

bool|null
isExclusive()

Is exclusive

setExclusive(bool|null $exclusive)

Set exclusive

int|null
getUsageLimit()

Get usage limit

setUsageLimit(int|null $usageLimit)

Set usage limit

int|null
getUsed()

Get usage

setUsed(int|null $used)

Set usage

incrementUsed()

Increment usage

DateTime|null
getStartsAt()

Get start date

setStartsAt(DateTime $startsAt = null)

Set start date

DateTime|null
getEndsAt()

Get end date

setEndsAt(DateTime $endsAt = null)

Set end date

bool|null
isCouponBased()

No description

setCouponBased(bool|null $couponBased)

No description

Collection|CouponInterface[]
getCoupons()

No description

setCoupons($coupons)

{@inheritdoc}

bool
hasCoupons()

No description

Boolean
hasCoupon(CouponInterface $coupon)

No description

addCoupon(CouponInterface $coupon)

No description

bool
hasRules()

No description

Collection|RuleInterface[]
getRules()

No description

bool
hasRule(RuleInterface $rule)

No description

addRule(RuleInterface $rule)

No description

bool
hasActions()

No description

Collection|ActionInterface[]
getActions()

No description

bool
hasAction(ActionInterface $action)

No description

addAction(ActionInterface $action)

No description

mixed
getUpdatedAt()

No description

mixed
setUpdatedAt(DateTime $updatedAt)

No description

mixed
getCreatedAt()

No description

mixed
setCreatedAt(DateTime $createdAt)

No description

addOrder(Order $order)

No description

removeOrder(Order $order)

No description

removeAllCoupons()

No description

ArrayCollection
getOrders()

No description

bool|null
isAllUsersSelected()

No description

setAllUsersSelected(bool|null $allUsersSelected)

No description

string
getType()

No description

bool
isCoupon()

No description

setType(string $type)

No description

string
getCode()

No description

setCode(string $code)

No description

bool
isSendByMail()

No description

setSendByMail(bool $sendByMail)

No description

isValid()

{@inheritdoc}

string
serialize()

(PHP 5 >= 5.1.0)
String representation of object

void
unserialize(string $serialized)

(PHP 5 >= 5.1.0)
Constructs the object

mixed
__clone()

When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties.

Details

at line 256
__construct()

Promotion constructor.

at line 268
int getId()

Return Value

int

at line 276
string|null getName()

Get name

Return Value

string|null

at line 284
PromotionInterface setName(string|null $name)

Set name

Parameters

string|null $name

Return Value

PromotionInterface

at line 294
string|null getDescription()

Get description

Return Value

string|null

at line 302
PromotionInterface setDescription(string|null $description)

Set description

Parameters

string|null $description

Return Value

PromotionInterface

at line 312
int|null getPriority()

Get priority

Return Value

int|null

at line 320
PromotionInterface setPriority(int|null $priority)

Set priority

Parameters

int|null $priority

Return Value

PromotionInterface

at line 330
bool|null isExclusive()

Is exclusive

Return Value

bool|null

at line 338
PromotionInterface setExclusive(bool|null $exclusive)

Set exclusive

Parameters

bool|null $exclusive

Return Value

PromotionInterface

at line 348
int|null getUsageLimit()

Get usage limit

Return Value

int|null

at line 356
PromotionInterface setUsageLimit(int|null $usageLimit)

Set usage limit

Parameters

int|null $usageLimit

Return Value

PromotionInterface

at line 366
int|null getUsed()

Get usage

Return Value

int|null

at line 374
PromotionInterface setUsed(int|null $used)

Set usage

Parameters

int|null $used

Return Value

PromotionInterface

at line 384
incrementUsed()

Increment usage

at line 394
DateTime|null getStartsAt()

Get start date

Return Value

DateTime|null

at line 402
PromotionInterface setStartsAt(DateTime $startsAt = null)

Set start date

Parameters

DateTime $startsAt

Return Value

PromotionInterface

at line 412
DateTime|null getEndsAt()

Get end date

Return Value

DateTime|null

at line 420
PromotionInterface setEndsAt(DateTime $endsAt = null)

Set end date

Parameters

DateTime $endsAt

Return Value

PromotionInterface

at line 430
bool|null isCouponBased()

Return Value

bool|null

at line 438
PromotionInterface setCouponBased(bool|null $couponBased)

Parameters

bool|null $couponBased

Return Value

PromotionInterface

at line 448
Collection|CouponInterface[] getCoupons()

Return Value

Collection|CouponInterface[]

at line 456
setCoupons($coupons)

{@inheritdoc}

Parameters

$coupons

at line 466
bool hasCoupons()

Return Value

bool

at line 474
Boolean hasCoupon(CouponInterface $coupon)

Parameters

CouponInterface $coupon

Return Value

Boolean

at line 482
PromotionInterface addCoupon(CouponInterface $coupon)

Parameters

CouponInterface $coupon

Return Value

PromotionInterface

at line 496
PromotionInterface removeCoupon(CouponInterface $coupon)

Parameters

CouponInterface $coupon

Return Value

PromotionInterface

at line 507
bool hasRules()

Return Value

bool

at line 515
Collection|RuleInterface[] getRules()

Return Value

Collection|RuleInterface[]

at line 523
bool hasRule(RuleInterface $rule)

Parameters

RuleInterface $rule

Return Value

bool

at line 531
PromotionInterface addRule(RuleInterface $rule)

Parameters

RuleInterface $rule

Return Value

PromotionInterface

at line 544
PromotionInterface removeRule(RuleInterface $rule)

Parameters

RuleInterface $rule

Return Value

PromotionInterface

at line 555
bool hasActions()

Return Value

bool

at line 563
Collection|ActionInterface[] getActions()

Return Value

Collection|ActionInterface[]

at line 571
bool hasAction(ActionInterface $action)

Parameters

ActionInterface $action

Return Value

bool

at line 579
PromotionInterface addAction(ActionInterface $action)

Parameters

ActionInterface $action

Return Value

PromotionInterface

at line 592
PromotionInterface removeAction(ActionInterface $action)

Parameters

ActionInterface $action

Return Value

PromotionInterface

at line 603
mixed getUpdatedAt()

Return Value

mixed

at line 611
mixed setUpdatedAt(DateTime $updatedAt)

Parameters

DateTime $updatedAt

Return Value

mixed

at line 621
mixed getCreatedAt()

Return Value

mixed

at line 629
mixed setCreatedAt(DateTime $createdAt)

Parameters

DateTime $createdAt

Return Value

mixed

at line 639
PromotionInterface addOrder(Order $order)

Parameters

Order $order

Return Value

PromotionInterface

at line 647
PromotionInterface removeOrder(Order $order)

Parameters

Order $order

Return Value

PromotionInterface

at line 655
Promotion removeAllCoupons()

Return Value

Promotion

at line 668
ArrayCollection getOrders()

Return Value

ArrayCollection

at line 676
bool|null isAllUsersSelected()

Return Value

bool|null

at line 686
Promotion setAllUsersSelected(bool|null $allUsersSelected)

Parameters

bool|null $allUsersSelected

Return Value

Promotion

at line 696
string getType()

Return Value

string

at line 704
bool isCoupon()

Return Value

bool

at line 714
Promotion setType(string $type)

Parameters

string $type

Return Value

Promotion

at line 724
string getCode()

Return Value

string

at line 734
Promotion setCode(string $code)

Parameters

string $code

Return Value

Promotion

at line 744
bool isSendByMail()

Return Value

bool

at line 754
Promotion setSendByMail(bool $sendByMail)

Parameters

bool $sendByMail

Return Value

Promotion

at line 764
isValid()

{@inheritdoc}

at line 779
string serialize()

(PHP 5 >= 5.1.0)
String representation of object

Return Value

string the string representation of the object or null

at line 799
void unserialize(string $serialized)

(PHP 5 >= 5.1.0)
Constructs the object

Parameters

string $serialized The string representation of the object.

Return Value

void

at line 818
mixed __clone()

When an object is cloned, PHP 5 will perform a shallow copy of all of the object's properties.

Any properties that are references to other variables, will remain references. Once the cloning is complete, if a __clone() method is defined, then the newly created object's __clone() method will be called, to allow any necessary properties that need to be changed. NOT CALLABLE DIRECTLY.

Return Value

mixed