commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-import
src
Models
Customfields
ReferenceSetFieldModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Import\Models\Customfields
;
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\KeyReferenceCollection
;
16
use stdClass;
17
21
final
class
ReferenceSetFieldModel
extends
JsonObjectModel
implements
ReferenceSetField
22
{
23
public
const
DISCRIMINATOR_VALUE
=
'ReferenceSet'
;
28
protected
$type
;
29
34
protected
$value
;
35
36
40
public
function
__construct
(
41
?
KeyReferenceCollection
$value
=
null
,
42
?
string
$type
=
null
43
) {
44
$this->value =
$value
;
45
$this->type =
$type
??
self::DISCRIMINATOR_VALUE
;
46
}
47
54
public
function
getType
()
55
{
56
if
(is_null($this->type)) {
58
$data = $this->
raw
(self::FIELD_TYPE);
59
if
(is_null($data)) {
60
return
null
;
61
}
62
$this->type = (string) $data;
63
}
64
65
return
$this->type
;
66
}
67
72
public
function
getValue
()
73
{
74
if
(is_null($this->value)) {
76
$data = $this->
raw
(self::FIELD_VALUE);
77
if
(is_null($data)) {
78
return
null
;
79
}
80
$this->value =
KeyReferenceCollection::fromArray
($data);
81
}
82
83
return
$this->value
;
84
}
85
86
90
public
function
setValue
(?
KeyReferenceCollection
$value
): void
91
{
92
$this->value =
$value
;
93
}
94
}
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\Base\MapperSequence\fromArray
static fromArray(array $data)
Definition:
MapperSequence.php:56
Commercetools\Import\Models\Common\KeyReferenceCollection
Definition:
KeyReferenceCollection.php:26
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel
Definition:
ReferenceSetFieldModel.php:22
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition:
ReferenceSetFieldModel.php:23
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\setValue
setValue(?KeyReferenceCollection $value)
Definition:
ReferenceSetFieldModel.php:90
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\$value
$value
Definition:
ReferenceSetFieldModel.php:34
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\$type
$type
Definition:
ReferenceSetFieldModel.php:28
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\getType
getType()
Definition:
ReferenceSetFieldModel.php:54
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\__construct
__construct(?KeyReferenceCollection $value=null, ?string $type=null)
Definition:
ReferenceSetFieldModel.php:40
Commercetools\Import\Models\Customfields\ReferenceSetFieldModel\getValue
getValue()
Definition:
ReferenceSetFieldModel.php:72
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Import\Models\Customfields\ReferenceSetField
Definition:
ReferenceSetField.php:16
Commercetools\Import\Models\Customfields
Definition:
BooleanField.php:9
Generated by
1.9.1