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
ProductSelectionAssignmentModel.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
ProductSelectionAssignmentModel
extends
JsonObjectModel
implements
ProductSelectionAssignment
23
{
28
protected
$product
;
29
34
protected
$productSelection
;
35
40
protected
$variantSelection
;
41
46
protected
$variantExclusion
;
47
48
52
public
function
__construct
(
53
?
ProductReference
$product
=
null
,
54
?
ProductSelectionReference
$productSelection
=
null
,
55
?
ProductVariantSelection
$variantSelection
=
null
,
56
?
ProductVariantExclusion
$variantExclusion
=
null
57
) {
58
$this->product =
$product
;
59
$this->productSelection =
$productSelection
;
60
$this->variantSelection =
$variantSelection
;
61
$this->variantExclusion =
$variantExclusion
;
62
}
63
70
public
function
getProduct
()
71
{
72
if
(is_null($this->product)) {
74
$data = $this->
raw
(self::FIELD_PRODUCT);
75
if
(is_null($data)) {
76
return
null
;
77
}
78
79
$this->product = ProductReferenceModel::of($data);
80
}
81
82
return
$this->product
;
83
}
84
91
public
function
getProductSelection
()
92
{
93
if
(is_null($this->productSelection)) {
95
$data = $this->
raw
(self::FIELD_PRODUCT_SELECTION);
96
if
(is_null($data)) {
97
return
null
;
98
}
99
100
$this->productSelection =
ProductSelectionReferenceModel::of
($data);
101
}
102
103
return
$this->productSelection
;
104
}
105
115
public
function
getVariantSelection
()
116
{
117
if
(is_null($this->variantSelection)) {
119
$data = $this->
raw
(self::FIELD_VARIANT_SELECTION);
120
if
(is_null($data)) {
121
return
null
;
122
}
123
$className =
ProductVariantSelectionModel::resolveDiscriminatorClass
($data);
124
$this->variantSelection = $className::of($data);
125
}
126
127
return
$this->variantSelection
;
128
}
129
139
public
function
getVariantExclusion
()
140
{
141
if
(is_null($this->variantExclusion)) {
143
$data = $this->
raw
(self::FIELD_VARIANT_EXCLUSION);
144
if
(is_null($data)) {
145
return
null
;
146
}
147
148
$this->variantExclusion =
ProductVariantExclusionModel::of
($data);
149
}
150
151
return
$this->variantExclusion
;
152
}
153
154
158
public
function
setProduct
(?
ProductReference
$product
): void
159
{
160
$this->product =
$product
;
161
}
162
166
public
function
setProductSelection
(?
ProductSelectionReference
$productSelection
): void
167
{
168
$this->productSelection =
$productSelection
;
169
}
170
174
public
function
setVariantSelection
(?
ProductVariantSelection
$variantSelection
): void
175
{
176
$this->variantSelection =
$variantSelection
;
177
}
178
182
public
function
setVariantExclusion
(?
ProductVariantExclusion
$variantExclusion
): void
183
{
184
$this->variantExclusion =
$variantExclusion
;
185
}
186
}
Commercetools\Api\Models\Product\ProductReferenceModel
Definition
ProductReferenceModel.php:23
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel
Definition
ProductSelectionAssignmentModel.php:23
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\setVariantSelection
setVariantSelection(?ProductVariantSelection $variantSelection)
Definition
ProductSelectionAssignmentModel.php:174
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\setVariantExclusion
setVariantExclusion(?ProductVariantExclusion $variantExclusion)
Definition
ProductSelectionAssignmentModel.php:182
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\setProductSelection
setProductSelection(?ProductSelectionReference $productSelection)
Definition
ProductSelectionAssignmentModel.php:166
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\$variantSelection
$variantSelection
Definition
ProductSelectionAssignmentModel.php:40
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\getVariantSelection
getVariantSelection()
Definition
ProductSelectionAssignmentModel.php:115
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\setProduct
setProduct(?ProductReference $product)
Definition
ProductSelectionAssignmentModel.php:158
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\getProductSelection
getProductSelection()
Definition
ProductSelectionAssignmentModel.php:91
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\__construct
__construct(?ProductReference $product=null, ?ProductSelectionReference $productSelection=null, ?ProductVariantSelection $variantSelection=null, ?ProductVariantExclusion $variantExclusion=null)
Definition
ProductSelectionAssignmentModel.php:52
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\$product
$product
Definition
ProductSelectionAssignmentModel.php:28
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\$productSelection
$productSelection
Definition
ProductSelectionAssignmentModel.php:34
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\$variantExclusion
$variantExclusion
Definition
ProductSelectionAssignmentModel.php:46
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\getVariantExclusion
getVariantExclusion()
Definition
ProductSelectionAssignmentModel.php:139
Commercetools\Api\Models\ProductSelection\ProductSelectionAssignmentModel\getProduct
getProduct()
Definition
ProductSelectionAssignmentModel.php:70
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\ProductSelectionAssignment
Definition
ProductSelectionAssignment.php:16
Commercetools\Api\Models\ProductSelection\ProductSelectionReference
Definition
ProductSelectionReference.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