commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
lib
commercetools-api
src
Models
Cart
DirectDiscountDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Cart
;
10
11
use
Commercetools\Api\Models\CartDiscount\CartDiscountTarget
;
12
use
Commercetools\Api\Models\CartDiscount\CartDiscountTargetModel
;
13
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraft
;
14
use
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftModel
;
15
use
Commercetools\Base\DateTimeImmutableCollection
;
16
use
Commercetools\Base\JsonObject
;
17
use
Commercetools\Base\JsonObjectModel
;
18
use
Commercetools\Base\MapperFactory
;
19
use stdClass;
20
24
final
class
DirectDiscountDraftModel
extends
JsonObjectModel
implements
DirectDiscountDraft
25
{
30
protected
$value
;
31
36
protected
$target
;
37
42
protected
$participateInBestDealSelection
;
43
44
48
public
function
__construct
(
49
?
CartDiscountValueDraft
$value
=
null
,
50
?
CartDiscountTarget
$target
=
null
,
51
?
bool
$participateInBestDealSelection
=
null
52
) {
53
$this->value =
$value
;
54
$this->target =
$target
;
55
$this->participateInBestDealSelection =
$participateInBestDealSelection
;
56
}
57
64
public
function
getValue
()
65
{
66
if
(is_null($this->value)) {
68
$data = $this->
raw
(self::FIELD_VALUE);
69
if
(is_null($data)) {
70
return
null
;
71
}
72
$className =
CartDiscountValueDraftModel::resolveDiscriminatorClass
($data);
73
$this->value = $className::of($data);
74
}
75
76
return
$this->value
;
77
}
78
86
public
function
getTarget
()
87
{
88
if
(is_null($this->target)) {
90
$data = $this->
raw
(self::FIELD_TARGET);
91
if
(is_null($data)) {
92
return
null
;
93
}
94
$className = CartDiscountTargetModel::resolveDiscriminatorClass($data);
95
$this->target = $className::of($data);
96
}
97
98
return
$this->target
;
99
}
100
111
public
function
getParticipateInBestDealSelection
()
112
{
113
if
(is_null($this->participateInBestDealSelection)) {
115
$data = $this->
raw
(self::FIELD_PARTICIPATE_IN_BEST_DEAL_SELECTION);
116
if
(is_null($data)) {
117
return
null
;
118
}
119
$this->participateInBestDealSelection = (bool) $data;
120
}
121
122
return
$this->participateInBestDealSelection
;
123
}
124
125
129
public
function
setValue
(?
CartDiscountValueDraft
$value
): void
130
{
131
$this->value =
$value
;
132
}
133
137
public
function
setTarget
(?
CartDiscountTarget
$target
): void
138
{
139
$this->target =
$target
;
140
}
141
145
public
function
setParticipateInBestDealSelection
(?
bool
$participateInBestDealSelection
): void
146
{
147
$this->participateInBestDealSelection =
$participateInBestDealSelection
;
148
}
149
}
Commercetools\Api\Models\Cart\DirectDiscountDraftModel
Definition
DirectDiscountDraftModel.php:25
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\$value
$value
Definition
DirectDiscountDraftModel.php:30
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\$participateInBestDealSelection
$participateInBestDealSelection
Definition
DirectDiscountDraftModel.php:42
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\getTarget
getTarget()
Definition
DirectDiscountDraftModel.php:86
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\getValue
getValue()
Definition
DirectDiscountDraftModel.php:64
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\$target
$target
Definition
DirectDiscountDraftModel.php:36
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\setTarget
setTarget(?CartDiscountTarget $target)
Definition
DirectDiscountDraftModel.php:137
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\setValue
setValue(?CartDiscountValueDraft $value)
Definition
DirectDiscountDraftModel.php:129
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\setParticipateInBestDealSelection
setParticipateInBestDealSelection(?bool $participateInBestDealSelection)
Definition
DirectDiscountDraftModel.php:145
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\__construct
__construct(?CartDiscountValueDraft $value=null, ?CartDiscountTarget $target=null, ?bool $participateInBestDealSelection=null)
Definition
DirectDiscountDraftModel.php:48
Commercetools\Api\Models\Cart\DirectDiscountDraftModel\getParticipateInBestDealSelection
getParticipateInBestDealSelection()
Definition
DirectDiscountDraftModel.php:111
Commercetools\Api\Models\CartDiscount\CartDiscountTargetModel
Definition
CartDiscountTargetModel.php:21
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftModel
Definition
CartDiscountValueDraftModel.php:21
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraftModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition
CartDiscountValueDraftModel.php:75
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition
BaseJsonObject.php:57
Commercetools\Base\DateTimeImmutableCollection
Definition
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition
MapperFactory.php:16
Commercetools\Api\Models\Cart\DirectDiscountDraft
Definition
DirectDiscountDraft.php:17
Commercetools\Api\Models\CartDiscount\CartDiscountTarget
Definition
CartDiscountTarget.php:15
Commercetools\Api\Models\CartDiscount\CartDiscountValueDraft
Definition
CartDiscountValueDraft.php:15
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\Cart
Definition
AbsoluteAllocation.php:9
Generated by
1.9.8