commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
lib
commercetools-api
src
Models
Review
ReviewSetTargetActionModel.php
1
<?php
2
3
declare(strict_types=1);
9
namespace
Commercetools\Api\Models\Review
;
10
11
use
Commercetools\Api\Models\Channel\ChannelResourceIdentifier
;
12
use
Commercetools\Api\Models\Channel\ChannelResourceIdentifierModel
;
13
use
Commercetools\Api\Models\Product\ProductResourceIdentifier
;
14
use
Commercetools\Api\Models\Product\ProductResourceIdentifierModel
;
15
use
Commercetools\Base\DateTimeImmutableCollection
;
16
use
Commercetools\Base\JsonObject
;
17
use
Commercetools\Base\JsonObjectModel
;
18
use
Commercetools\Base\MapperFactory
;
19
use stdClass;
20
24
final
class
ReviewSetTargetActionModel
extends
JsonObjectModel
implements
ReviewSetTargetAction
25
{
26
public
const
DISCRIMINATOR_VALUE
=
'setTarget'
;
31
protected
$action
;
32
37
protected
$target
;
38
39
43
public
function
__construct
(
44
?
JsonObject
$target
=
null
,
45
?
string
$action
=
null
46
) {
47
$this->target =
$target
;
48
$this->action =
$action
??
self::DISCRIMINATOR_VALUE
;
49
}
50
55
public
function
getAction
()
56
{
57
if
(is_null($this->action)) {
59
$data = $this->
raw
(self::FIELD_ACTION);
60
if
(is_null($data)) {
61
return
null
;
62
}
63
$this->action = (string) $data;
64
}
65
66
return
$this->action
;
67
}
68
75
public
function
getTarget
()
76
{
77
if
(is_null($this->target)) {
79
$data = $this->
raw
(self::FIELD_TARGET);
80
if
(is_null($data)) {
81
return
null
;
82
}
83
$this->target = $data;
84
}
85
86
return
$this->target
;
87
}
88
94
public
function
getTargetAsProductResourceIdentifier
()
95
{
97
$data = $this->
raw
(self::FIELD_TARGET);
98
if
(is_null($data)) {
99
return
null
;
100
}
101
102
return
ProductResourceIdentifierModel::of
($data);
103
}
104
110
public
function
getTargetAsChannelResourceIdentifier
()
111
{
113
$data = $this->
raw
(self::FIELD_TARGET);
114
if
(is_null($data)) {
115
return
null
;
116
}
117
118
return
ChannelResourceIdentifierModel::of
($data);
119
}
120
124
public
function
setTarget
(?
JsonObject
$target
): void
125
{
126
$this->target =
$target
;
127
}
128
}
Commercetools\Api\Models\Channel\ChannelResourceIdentifierModel
Definition:
ChannelResourceIdentifierModel.php:23
Commercetools\Api\Models\Product\ProductResourceIdentifierModel
Definition:
ProductResourceIdentifierModel.php:23
Commercetools\Api\Models\Review\ReviewSetTargetActionModel
Definition:
ReviewSetTargetActionModel.php:25
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\getTargetAsChannelResourceIdentifier
getTargetAsChannelResourceIdentifier()
Definition:
ReviewSetTargetActionModel.php:110
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\$action
$action
Definition:
ReviewSetTargetActionModel.php:31
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\getTarget
getTarget()
Definition:
ReviewSetTargetActionModel.php:75
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\setTarget
setTarget(?JsonObject $target)
Definition:
ReviewSetTargetActionModel.php:124
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\getAction
getAction()
Definition:
ReviewSetTargetActionModel.php:55
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\$target
$target
Definition:
ReviewSetTargetActionModel.php:37
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\__construct
__construct(?JsonObject $target=null, ?string $action=null)
Definition:
ReviewSetTargetActionModel.php:43
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\DISCRIMINATOR_VALUE
const DISCRIMINATOR_VALUE
Definition:
ReviewSetTargetActionModel.php:26
Commercetools\Api\Models\Review\ReviewSetTargetActionModel\getTargetAsProductResourceIdentifier
getTargetAsProductResourceIdentifier()
Definition:
ReviewSetTargetActionModel.php:94
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\Channel\ChannelResourceIdentifier
Definition:
ChannelResourceIdentifier.php:16
Commercetools\Api\Models\Product\ProductResourceIdentifier
Definition:
ProductResourceIdentifier.php:16
Commercetools\Api\Models\Review\ReviewSetTargetAction
Definition:
ReviewSetTargetAction.php:17
Commercetools\Base\JsonObject
Definition:
JsonObject.php:15
Commercetools\Api\Models\Review
Definition:
Review.php:9
Generated by
1.9.1