Discount code model
Struct for a discount code record assigned to an order/basket item or a DiscountGroup relation.
package |
NextEvent\PHPSDK\Model |
---|
__call(string $name, array $args) : mixed
If the source of your model contains, e.g. a property named 'my_property',
you can call getMyProperty()
to retrieve it's value.
string
array
mixed
__construct(array $source)
Parse source data.
Throws |
|
---|
array
The source data as received from the API
get(string $var) : mixed
Should be used, if you expect the model to have custom properties which are not known/covered by the known getters
string
mixed
getCode() : string
string
getDisplayname() : string
This is basically an alias for self::getTitle()
string
getId() : integer
integer
getTitle() : string
string
getValidFrom() : \NextEvent\PHPSDK\Model\DateTime|null
getValidTo() : \NextEvent\PHPSDK\Model\DateTime|null
isNew() : boolean
inheritdoc | |
---|---|
boolean
isValid() : boolean
boolean
serialize() : string
Implements Serializable interface
string
setDiscountGroup(\NextEvent\PHPSDK\Model\DiscountGroup $group) : \NextEvent\PHPSDK\Model\DiscountCode
This operation is only permitted on new discount code models
Throws |
|
---|
\NextEvent\PHPSDK\Model\DiscountCode
setSource(array $source) : \NextEvent\PHPSDK\Model\MutableModel
access |
private |
---|
array
The source data as received from the API.
\NextEvent\PHPSDK\Model\MutableModel
spawn(array $data, \NextEvent\PHPSDK\Model\DiscountGroup $discountGroup) : \NextEvent\PHPSDK\Model\DiscountCode
The resulting instance will be marked as a new model which has not been persisted via API.
Throws |
|
---|
array
Model data as hash array with the following fields
code
(string) The unique discount codetitle
(string) Optional title to be displayed (will be inherited from the discount group if omitted)valid_from
(DateTime) Begin of the validity periodvalid_to
(DateTime) End of the validity periodformdata
(array) Hash array (key => value pairs) with form data to be pre-filled into a personalization form when booking.\NextEvent\PHPSDK\Model\DiscountCode
toArray() : array
array
toLogContext() : array
Implements the LogContextInterface interface
array
toString() : string
string
unserialize( $serialized)
Implements Serializable interface