commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Common
DiscountedPriceDraftModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Common
;
10
11
use
Commercetools\Api\Models\ProductDiscount\ProductDiscountReference
;
12
use
Commercetools\Api\Models\ProductDiscount\ProductDiscountReferenceModel
;
13
use
Commercetools\Base\DateTimeImmutableCollection
;
14
use
Commercetools\Base\JsonObject
;
15
use
Commercetools\Base\JsonObjectModel
;
16
use
Commercetools\Base\MapperFactory
;
17
use stdClass;
18
22
final
class
DiscountedPriceDraftModel
extends
JsonObjectModel
implements
DiscountedPriceDraft
23
{
28
protected
$value
;
29
34
protected
$discount
;
35
36
40
public
function
__construct
(
41
?
Money
$value
=
null
,
42
?
ProductDiscountReference
$discount
=
null
43
) {
44
$this->value =
$value
;
45
$this->discount =
$discount
;
46
}
47
54
public
function
getValue
()
55
{
56
if
(is_null($this->value)) {
58
$data = $this->
raw
(self::FIELD_VALUE);
59
if
(is_null($data)) {
60
return
null
;
61
}
62
63
$this->value =
MoneyModel::of
($data);
64
}
65
66
return
$this->value
;
67
}
68
75
public
function
getDiscount
()
76
{
77
if
(is_null($this->discount)) {
79
$data = $this->
raw
(self::FIELD_DISCOUNT);
80
if
(is_null($data)) {
81
return
null
;
82
}
83
84
$this->discount =
ProductDiscountReferenceModel::of
($data);
85
}
86
87
return
$this->discount
;
88
}
89
90
94
public
function
setValue
(?
Money
$value
): void
95
{
96
$this->value =
$value
;
97
}
98
102
public
function
setDiscount
(?
ProductDiscountReference
$discount
): void
103
{
104
$this->discount =
$discount
;
105
}
106
}
Commercetools\Api\Models\Common\DiscountedPriceDraftModel
Definition:
DiscountedPriceDraftModel.php:23
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\getValue
getValue()
Definition:
DiscountedPriceDraftModel.php:54
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\setValue
setValue(?Money $value)
Definition:
DiscountedPriceDraftModel.php:94
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\setDiscount
setDiscount(?ProductDiscountReference $discount)
Definition:
DiscountedPriceDraftModel.php:102
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\$value
$value
Definition:
DiscountedPriceDraftModel.php:28
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\$discount
$discount
Definition:
DiscountedPriceDraftModel.php:34
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\getDiscount
getDiscount()
Definition:
DiscountedPriceDraftModel.php:75
Commercetools\Api\Models\Common\DiscountedPriceDraftModel\__construct
__construct(?Money $value=null, ?ProductDiscountReference $discount=null)
Definition:
DiscountedPriceDraftModel.php:40
Commercetools\Api\Models\ProductDiscount\ProductDiscountReferenceModel
Definition:
ProductDiscountReferenceModel.php:23
Commercetools\Base\BaseJsonObject\raw
raw(string $field)
Definition:
BaseJsonObject.php:57
Commercetools\Base\BaseJsonObject\of
static of($data=null)
Definition:
BaseJsonObject.php:26
Commercetools\Base\DateTimeImmutableCollection
Definition:
DateTimeImmutableCollection.php:21
Commercetools\Base\JsonObjectModel
Definition:
JsonObjectModel.php:15
Commercetools\Base\MapperFactory
Definition:
MapperFactory.php:16
Commercetools\Api\Models\Common\DiscountedPriceDraft
Definition:
DiscountedPriceDraft.php:16
Commercetools\Api\Models\Common\Money
Definition:
Money.php:15
Commercetools\Api\Models\ProductDiscount\ProductDiscountReference
Definition:
ProductDiscountReference.php:16
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Common
Definition:
Address.php:9
Generated by
1.9.1