commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-history
src
Models
Common
VariantModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\History\Models\Common
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use stdClass;
16
20
final
class
VariantModel
extends
JsonObjectModel
implements
Variant
21
{
22
23
28
protected
$id
;
29
34
protected
$sku
;
35
40
protected
$key
;
41
42
46
public
function
__construct
(
47
?
int
$id
=
null
,
48
?
string
$sku
=
null
,
49
?
string
$key
=
null
50
) {
51
$this->
id
=
$id
;
52
$this->sku =
$sku
;
53
$this->key =
$key
;
54
55
}
56
61
public
function
getId
()
62
{
63
if
(is_null($this->
id
)) {
65
$data = $this->
raw
(self::FIELD_ID);
66
if
(is_null($data)) {
67
return
null
;
68
}
69
$this->
id
= (int) $data;
70
}
71
72
return
$this->id
;
73
}
74
79
public
function
getSku
()
80
{
81
if
(is_null($this->sku)) {
83
$data = $this->
raw
(self::FIELD_SKU);
84
if
(is_null($data)) {
85
return
null
;
86
}
87
$this->sku = (string) $data;
88
}
89
90
return
$this->sku
;
91
}
92
97
public
function
getKey
()
98
{
99
if
(is_null($this->key)) {
101
$data = $this->
raw
(self::FIELD_KEY);
102
if
(is_null($data)) {
103
return
null
;
104
}
105
$this->key = (string) $data;
106
}
107
108
return
$this->key
;
109
}
110
111
115
public
function
setId
(?
int
$id
): void
116
{
117
$this->
id
=
$id
;
118
}
119
123
public
function
setSku
(?
string
$sku
): void
124
{
125
$this->sku =
$sku
;
126
}
127
131
public
function
setKey
(?
string
$key
): void
132
{
133
$this->key =
$key
;
134
}
135
136
137
138
}
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\History\Models\Common\VariantModel
Definition:
VariantModel.php:21
Commercetools\History\Models\Common\VariantModel\setId
setId(?int $id)
Definition:
VariantModel.php:115
Commercetools\History\Models\Common\VariantModel\$key
$key
Definition:
VariantModel.php:40
Commercetools\History\Models\Common\VariantModel\getKey
getKey()
Definition:
VariantModel.php:97
Commercetools\History\Models\Common\VariantModel\$sku
$sku
Definition:
VariantModel.php:34
Commercetools\History\Models\Common\VariantModel\getSku
getSku()
Definition:
VariantModel.php:79
Commercetools\History\Models\Common\VariantModel\getId
getId()
Definition:
VariantModel.php:61
Commercetools\History\Models\Common\VariantModel\setSku
setSku(?string $sku)
Definition:
VariantModel.php:123
Commercetools\History\Models\Common\VariantModel\setKey
setKey(?string $key)
Definition:
VariantModel.php:131
Commercetools\History\Models\Common\VariantModel\__construct
__construct(?int $id=null, ?string $sku=null, ?string $key=null)
Definition:
VariantModel.php:46
Commercetools\History\Models\Common\VariantModel\$id
$id
Definition:
VariantModel.php:28
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\History\Models\Common\Variant
Definition:
Variant.php:15
Commercetools\History\Models\Common
Definition:
Address.php:9
Generated by
1.9.1