commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
VariantAddAssetActionModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
23{
24 public const DISCRIMINATOR_VALUE = 'addAsset';
29 protected $action;
30
35 protected $staged;
36
41 protected $asset;
42
47 protected $position;
48
49
53 public function __construct(
54 ?bool $staged = null,
55 ?AssetDraft $asset = null,
56 ?int $position = null,
57 ?string $action = null
58 ) {
59 $this->staged = $staged;
60 $this->asset = $asset;
61 $this->position = $position;
62 $this->action = $action ?? self::DISCRIMINATOR_VALUE;
63 }
64
69 public function getAction()
70 {
71 if (is_null($this->action)) {
73 $data = $this->raw(self::FIELD_ACTION);
74 if (is_null($data)) {
75 return null;
76 }
77 $this->action = (string) $data;
78 }
79
80 return $this->action;
81 }
82
89 public function getStaged()
90 {
91 if (is_null($this->staged)) {
93 $data = $this->raw(self::FIELD_STAGED);
94 if (is_null($data)) {
95 return null;
96 }
97 $this->staged = (bool) $data;
98 }
99
100 return $this->staged;
101 }
102
109 public function getAsset()
110 {
111 if (is_null($this->asset)) {
113 $data = $this->raw(self::FIELD_ASSET);
114 if (is_null($data)) {
115 return null;
116 }
117
118 $this->asset = AssetDraftModel::of($data);
119 }
120
121 return $this->asset;
122 }
123
130 public function getPosition()
131 {
132 if (is_null($this->position)) {
134 $data = $this->raw(self::FIELD_POSITION);
135 if (is_null($data)) {
136 return null;
137 }
138 $this->position = (int) $data;
139 }
140
141 return $this->position;
142 }
143
144
148 public function setStaged(?bool $staged): void
149 {
150 $this->staged = $staged;
151 }
152
156 public function setAsset(?AssetDraft $asset): void
157 {
158 $this->asset = $asset;
159 }
160
164 public function setPosition(?int $position): void
165 {
166 $this->position = $position;
167 }
168}
__construct(?bool $staged=null, ?AssetDraft $asset=null, ?int $position=null, ?string $action=null)