commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-import
src
Models
Productvariants
ReferenceAttributeModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Import\Models\Productvariants
;
10
11
use
Commercetools\Base\DateTimeImmutableCollection
;
12
use
Commercetools\Base\JsonObject
;
13
use
Commercetools\Base\JsonObjectModel
;
14
use
Commercetools\Base\MapperFactory
;
15
use
Commercetools\Import\Models\Common\KeyReference
;
16
use
Commercetools\Import\Models\Common\KeyReferenceModel
;
17
use stdClass;
18
22
final
class
ReferenceAttributeModel
extends
JsonObjectModel
implements
ReferenceAttribute
23
{
24
public
const
DISCRIMINATOR_VALUE
=
'reference'
;
29
protected
$name
;
30
35
protected
$type
;
36
41
protected
$value
;
42
43
47
public
function
__construct
(
48
?
string
$name
=
null
,
49
?
KeyReference
$value
=
null
,
50
?
string
$type
=
null
51
) {
52
$this->name =
$name
;
53
$this->value =
$value
;
54
$this->type =
$type
??
self::DISCRIMINATOR_VALUE
;
55
}
56
65
public
function
getName
()
66
{
67
if
(is_null($this->name)) {
69
$data = $this->
raw
(self::FIELD_NAME);
70
if
(is_null($data)) {
71
return
null
;
72
}
73
$this->name = (string) $data;
74
}
75
76
return
$this->name
;
77
}
78
83
public
function
getType
()
84
{
85
if
(is_null($this->type)) {
87
$data = $this->
raw
(self::FIELD_TYPE);
88
if
(is_null($data)) {
89
return
null
;
90
}
91
$this->type = (string) $data;
92
}
93
94
return
$this->type
;
95
}
96
103
public
function
getValue
()
104
{
105
if
(is_null($this->value)) {
107
$data = $this->
raw
(self::FIELD_VALUE);
108
if
(is_null($data)) {
109
return
null
;
110
}
111
$className =
KeyReferenceModel::resolveDiscriminatorClass
($data);
112
$this->value = $className::of($data);
113
}
114
115
return
$this->value
;
116
}
117
118
122
public
function
setName
(?
string
$name
): void
123
{
124
$this->name =
$name
;
125
}
126
130
public
function
setValue
(?
KeyReference
$value
): void
131
{
132
$this->value =
$value
;
133
}
134
}
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\Import\Models\Common\KeyReferenceModel
Definition:
KeyReferenceModel.php:21
Commercetools\Import\Models\Common\KeyReferenceModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition:
KeyReferenceModel.php:126
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel
Definition:
ReferenceAttributeModel.php:23
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\setValue
setValue(?KeyReference $value)
Definition:
ReferenceAttributeModel.php:130
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\$type
$type
Definition:
ReferenceAttributeModel.php:35
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\__construct
__construct(?string $name=null, ?KeyReference $value=null, ?string $type=null)
Definition:
ReferenceAttributeModel.php:47
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\$value
$value
Definition:
ReferenceAttributeModel.php:41
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\getValue
getValue()
Definition:
ReferenceAttributeModel.php:103
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\setName
setName(?string $name)
Definition:
ReferenceAttributeModel.php:122
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\getName
getName()
Definition:
ReferenceAttributeModel.php:65
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\getType
getType()
Definition:
ReferenceAttributeModel.php:83
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\$name
$name
Definition:
ReferenceAttributeModel.php:29
Commercetools\Import\Models\Productvariants\ReferenceAttributeModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition:
ReferenceAttributeModel.php:24
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Import\Models\Common\KeyReference
Definition:
KeyReference.php:15
Commercetools\Import\Models\Productvariants\ReferenceAttribute
Definition:
ReferenceAttribute.php:16
Commercetools\Import\Models\Productvariants
Definition:
Attribute.php:9
Generated by
1.9.1