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
ProductSelection
AssignedProductReferenceModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\ProductSelection
;
10
11
use
Commercetools\Api\Models\Product\ProductReference
;
12
use
Commercetools\Api\Models\Product\ProductReferenceModel
;
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
AssignedProductReferenceModel
extends
JsonObjectModel
implements
AssignedProductReference
23
{
28
protected
$product
;
29
34
protected
$variantSelection
;
35
40
protected
$variantExclusion
;
41
42
46
public
function
__construct
(
47
?
ProductReference
$product
=
null
,
48
?
ProductVariantSelection
$variantSelection
=
null
,
49
?
ProductVariantExclusion
$variantExclusion
=
null
50
) {
51
$this->product =
$product
;
52
$this->variantSelection =
$variantSelection
;
53
$this->variantExclusion =
$variantExclusion
;
54
}
55
62
public
function
getProduct
()
63
{
64
if
(is_null($this->product)) {
66
$data = $this->
raw
(self::FIELD_PRODUCT);
67
if
(is_null($data)) {
68
return
null
;
69
}
70
71
$this->product = ProductReferenceModel::of($data);
72
}
73
74
return
$this->product
;
75
}
76
85
public
function
getVariantSelection
()
86
{
87
if
(is_null($this->variantSelection)) {
89
$data = $this->
raw
(self::FIELD_VARIANT_SELECTION);
90
if
(is_null($data)) {
91
return
null
;
92
}
93
$className =
ProductVariantSelectionModel::resolveDiscriminatorClass
($data);
94
$this->variantSelection = $className::of($data);
95
}
96
97
return
$this->variantSelection
;
98
}
99
108
public
function
getVariantExclusion
()
109
{
110
if
(is_null($this->variantExclusion)) {
112
$data = $this->
raw
(self::FIELD_VARIANT_EXCLUSION);
113
if
(is_null($data)) {
114
return
null
;
115
}
116
117
$this->variantExclusion =
ProductVariantExclusionModel::of
($data);
118
}
119
120
return
$this->variantExclusion
;
121
}
122
123
127
public
function
setProduct
(?
ProductReference
$product
): void
128
{
129
$this->product =
$product
;
130
}
131
135
public
function
setVariantSelection
(?
ProductVariantSelection
$variantSelection
): void
136
{
137
$this->variantSelection =
$variantSelection
;
138
}
139
143
public
function
setVariantExclusion
(?
ProductVariantExclusion
$variantExclusion
): void
144
{
145
$this->variantExclusion =
$variantExclusion
;
146
}
147
}
Commercetools\Api\Models\Product\ProductReferenceModel
Definition
ProductReferenceModel.php:23
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel
Definition
AssignedProductReferenceModel.php:23
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\setVariantExclusion
setVariantExclusion(?ProductVariantExclusion $variantExclusion)
Definition
AssignedProductReferenceModel.php:143
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\getVariantSelection
getVariantSelection()
Definition
AssignedProductReferenceModel.php:85
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\getVariantExclusion
getVariantExclusion()
Definition
AssignedProductReferenceModel.php:108
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\$variantSelection
$variantSelection
Definition
AssignedProductReferenceModel.php:34
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\$product
$product
Definition
AssignedProductReferenceModel.php:28
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\$variantExclusion
$variantExclusion
Definition
AssignedProductReferenceModel.php:40
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\__construct
__construct(?ProductReference $product=null, ?ProductVariantSelection $variantSelection=null, ?ProductVariantExclusion $variantExclusion=null)
Definition
AssignedProductReferenceModel.php:46
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\setProduct
setProduct(?ProductReference $product)
Definition
AssignedProductReferenceModel.php:127
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\setVariantSelection
setVariantSelection(?ProductVariantSelection $variantSelection)
Definition
AssignedProductReferenceModel.php:135
Commercetools\Api\Models\ProductSelection\AssignedProductReferenceModel\getProduct
getProduct()
Definition
AssignedProductReferenceModel.php:62
Commercetools\Api\Models\ProductSelection\ProductVariantSelectionModel\resolveDiscriminatorClass
static resolveDiscriminatorClass($value)
Definition
ProductVariantSelectionModel.php:75
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\Product\ProductReference
Definition
ProductReference.php:16
Commercetools\Api\Models\ProductSelection\AssignedProductReference
Definition
AssignedProductReference.php:16
Commercetools\Api\Models\ProductSelection\ProductVariantExclusion
Definition
ProductVariantExclusion.php:15
Commercetools\Api\Models\ProductSelection\ProductVariantSelection
Definition
ProductVariantSelection.php:15
Commercetools\Base\JsonObject
Definition
JsonObject.php:15
Commercetools\Api\Models\ProductSelection
Definition
AssignedProductReference.php:9
Generated by
1.9.8