commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
RecordModel.php
1 <?php
2 
3 declare(strict_types=1);
10 
15 use stdClass;
24 
28 final class RecordModel extends JsonObjectModel implements Record
29 {
30 
31 
36  protected $version;
37 
42  protected $previousVersion;
43 
48  protected $type;
49 
54  protected $modifiedBy;
55 
60  protected $modifiedAt;
61 
66  protected $label;
67 
72  protected $previousLabel;
73 
78  protected $changes;
79 
84  protected $resource;
85 
90  protected $stores;
91 
96  protected $businessUnit;
97 
102  protected $withoutChanges;
103 
104 
108  public function __construct(
109  ?int $version = null,
110  ?int $previousVersion = null,
111  ?string $type = null,
112  ?ModifiedBy $modifiedBy = null,
113  ?string $modifiedAt = null,
114  ?Label $label = null,
115  ?Label $previousLabel = null,
116  ?ChangeCollection $changes = null,
119  ?KeyReference $businessUnit = null,
120  ?bool $withoutChanges = null
121  ) {
122  $this->version = $version;
123  $this->previousVersion = $previousVersion;
124  $this->type = $type;
125  $this->modifiedBy = $modifiedBy;
126  $this->modifiedAt = $modifiedAt;
127  $this->label = $label;
128  $this->previousLabel = $previousLabel;
129  $this->changes = $changes;
130  $this->resource = $resource;
131  $this->stores = $stores;
132  $this->businessUnit = $businessUnit;
133  $this->withoutChanges = $withoutChanges;
134 
135  }
136 
144  public function getVersion()
145  {
146  if (is_null($this->version)) {
148  $data = $this->raw(self::FIELD_VERSION);
149  if (is_null($data)) {
150  return null;
151  }
152  $this->version = (int) $data;
153  }
154 
155  return $this->version;
156  }
157 
164  public function getPreviousVersion()
165  {
166  if (is_null($this->previousVersion)) {
168  $data = $this->raw(self::FIELD_PREVIOUS_VERSION);
169  if (is_null($data)) {
170  return null;
171  }
172  $this->previousVersion = (int) $data;
173  }
174 
175  return $this->previousVersion;
176  }
177 
185  public function getType()
186  {
187  if (is_null($this->type)) {
189  $data = $this->raw(self::FIELD_TYPE);
190  if (is_null($data)) {
191  return null;
192  }
193  $this->type = (string) $data;
194  }
195 
196  return $this->type;
197  }
198 
205  public function getModifiedBy()
206  {
207  if (is_null($this->modifiedBy)) {
209  $data = $this->raw(self::FIELD_MODIFIED_BY);
210  if (is_null($data)) {
211  return null;
212  }
213 
214  $this->modifiedBy = ModifiedByModel::of($data);
215  }
216 
217  return $this->modifiedBy;
218  }
219 
226  public function getModifiedAt()
227  {
228  if (is_null($this->modifiedAt)) {
230  $data = $this->raw(self::FIELD_MODIFIED_AT);
231  if (is_null($data)) {
232  return null;
233  }
234  $this->modifiedAt = (string) $data;
235  }
236 
237  return $this->modifiedAt;
238  }
239 
246  public function getLabel()
247  {
248  if (is_null($this->label)) {
250  $data = $this->raw(self::FIELD_LABEL);
251  if (is_null($data)) {
252  return null;
253  }
254  $className = LabelModel::resolveDiscriminatorClass($data);
255  $this->label = $className::of($data);
256  }
257 
258  return $this->label;
259  }
260 
267  public function getPreviousLabel()
268  {
269  if (is_null($this->previousLabel)) {
271  $data = $this->raw(self::FIELD_PREVIOUS_LABEL);
272  if (is_null($data)) {
273  return null;
274  }
275  $className = LabelModel::resolveDiscriminatorClass($data);
276  $this->previousLabel = $className::of($data);
277  }
278 
279  return $this->previousLabel;
280  }
281 
289  public function getChanges()
290  {
291  if (is_null($this->changes)) {
293  $data = $this->raw(self::FIELD_CHANGES);
294  if (is_null($data)) {
295  return null;
296  }
297  $this->changes = ChangeCollection::fromArray($data);
298  }
299 
300  return $this->changes;
301  }
302 
309  public function getResource()
310  {
311  if (is_null($this->resource)) {
313  $data = $this->raw(self::FIELD_RESOURCE);
314  if (is_null($data)) {
315  return null;
316  }
317 
318  $this->resource = ResourceIdentifierModel::of($data);
319  }
320 
321  return $this->resource;
322  }
323 
330  public function getStores()
331  {
332  if (is_null($this->stores)) {
334  $data = $this->raw(self::FIELD_STORES);
335  if (is_null($data)) {
336  return null;
337  }
338  $this->stores = KeyReferenceCollection::fromArray($data);
339  }
340 
341  return $this->stores;
342  }
343 
350  public function getBusinessUnit()
351  {
352  if (is_null($this->businessUnit)) {
354  $data = $this->raw(self::FIELD_BUSINESS_UNIT);
355  if (is_null($data)) {
356  return null;
357  }
358 
359  $this->businessUnit = KeyReferenceModel::of($data);
360  }
361 
362  return $this->businessUnit;
363  }
364 
372  public function getWithoutChanges()
373  {
374  if (is_null($this->withoutChanges)) {
376  $data = $this->raw(self::FIELD_WITHOUT_CHANGES);
377  if (is_null($data)) {
378  return null;
379  }
380  $this->withoutChanges = (bool) $data;
381  }
382 
383  return $this->withoutChanges;
384  }
385 
386 
390  public function setVersion(?int $version): void
391  {
392  $this->version = $version;
393  }
394 
398  public function setPreviousVersion(?int $previousVersion): void
399  {
400  $this->previousVersion = $previousVersion;
401  }
402 
406  public function setType(?string $type): void
407  {
408  $this->type = $type;
409  }
410 
414  public function setModifiedBy(?ModifiedBy $modifiedBy): void
415  {
416  $this->modifiedBy = $modifiedBy;
417  }
418 
422  public function setModifiedAt(?string $modifiedAt): void
423  {
424  $this->modifiedAt = $modifiedAt;
425  }
426 
430  public function setLabel(?Label $label): void
431  {
432  $this->label = $label;
433  }
434 
438  public function setPreviousLabel(?Label $previousLabel): void
439  {
440  $this->previousLabel = $previousLabel;
441  }
442 
446  public function setChanges(?ChangeCollection $changes): void
447  {
448  $this->changes = $changes;
449  }
450 
454  public function setResource(?ResourceIdentifier $resource): void
455  {
456  $this->resource = $resource;
457  }
458 
462  public function setStores(?KeyReferenceCollection $stores): void
463  {
464  $this->stores = $stores;
465  }
466 
471  {
472  $this->businessUnit = $businessUnit;
473  }
474 
478  public function setWithoutChanges(?bool $withoutChanges): void
479  {
480  $this->withoutChanges = $withoutChanges;
481  }
482 
483 
484 
485 }
__construct(?int $version=null, ?int $previousVersion=null, ?string $type=null, ?ModifiedBy $modifiedBy=null, ?string $modifiedAt=null, ?Label $label=null, ?Label $previousLabel=null, ?ChangeCollection $changes=null, ?ResourceIdentifier $resource=null, ?KeyReferenceCollection $stores=null, ?KeyReference $businessUnit=null, ?bool $withoutChanges=null)