commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ExtensionInputModel.php
1<?php
2
3declare(strict_types=1);
10
17use stdClass;
18
23{
28 protected $action;
29
34 protected $resource;
35
40 protected $oldResource;
41
42
46 public function __construct(
47 ?string $action = null,
48 ?Reference $resource = null,
50 ) {
51 $this->action = $action;
52 $this->resource = $resource;
53 $this->oldResource = $oldResource;
54 }
55
62 public function getAction()
63 {
64 if (is_null($this->action)) {
66 $data = $this->raw(self::FIELD_ACTION);
67 if (is_null($data)) {
68 return null;
69 }
70 $this->action = (string) $data;
71 }
72
73 return $this->action;
74 }
75
82 public function getResource()
83 {
84 if (is_null($this->resource)) {
86 $data = $this->raw(self::FIELD_RESOURCE);
87 if (is_null($data)) {
88 return null;
89 }
90 $className = ReferenceModel::resolveDiscriminatorClass($data);
91 $this->resource = $className::of($data);
92 }
93
94 return $this->resource;
95 }
96
103 public function getOldResource()
104 {
105 if (is_null($this->oldResource)) {
107 $data = $this->raw(self::FIELD_OLD_RESOURCE);
108 if (is_null($data)) {
109 return null;
110 }
111 $className = ReferenceModel::resolveDiscriminatorClass($data);
112 $this->oldResource = $className::of($data);
113 }
114
115 return $this->oldResource;
116 }
117
118
122 public function setAction(?string $action): void
123 {
124 $this->action = $action;
125 }
126
130 public function setResource(?Reference $resource): void
131 {
132 $this->resource = $resource;
133 }
134
138 public function setOldResource(?Reference $oldResource): void
139 {
140 $this->oldResource = $oldResource;
141 }
142}
__construct(?string $action=null, ?Reference $resource=null, ?Reference $oldResource=null)