commercetools-sdk-php-v2
The commercetools platform, import-api and PHP sdks generated from our api reference.
Loading...
Searching...
No Matches
ImportContainerDeletedEventModel.php
1<?php
2
3declare(strict_types=1);
10
15use DateTimeImmutable;
16use stdClass;
17
22{
23 public const DISCRIMINATOR_VALUE = 'ImportContainerDeleted';
28 protected $id;
29
35
40 protected $resourceType;
41
46 protected $type;
47
52 protected $createdAt;
53
58 protected $data;
59
60
64 public function __construct(
65 ?string $id = null,
66 ?string $notificationType = null,
67 ?string $resourceType = null,
68 ?DateTimeImmutable $createdAt = null,
70 ?string $type = null
71 ) {
72 $this->id = $id;
73 $this->notificationType = $notificationType;
74 $this->resourceType = $resourceType;
75 $this->createdAt = $createdAt;
76 $this->data = $data;
77 $this->type = $type ?? self::DISCRIMINATOR_VALUE;
78 }
79
86 public function getId()
87 {
88 if (is_null($this->id)) {
90 $data = $this->raw(self::FIELD_ID);
91 if (is_null($data)) {
92 return null;
93 }
94 $this->id = (string) $data;
95 }
96
97 return $this->id;
98 }
99
104 public function getNotificationType()
105 {
106 if (is_null($this->notificationType)) {
108 $data = $this->raw(self::FIELD_NOTIFICATION_TYPE);
109 if (is_null($data)) {
110 return null;
111 }
112 $this->notificationType = (string) $data;
113 }
114
116 }
117
122 public function getResourceType()
123 {
124 if (is_null($this->resourceType)) {
126 $data = $this->raw(self::FIELD_RESOURCE_TYPE);
127 if (is_null($data)) {
128 return null;
129 }
130 $this->resourceType = (string) $data;
131 }
132
133 return $this->resourceType;
134 }
135
142 public function getType()
143 {
144 if (is_null($this->type)) {
146 $data = $this->raw(self::FIELD_TYPE);
147 if (is_null($data)) {
148 return null;
149 }
150 $this->type = (string) $data;
151 }
152
153 return $this->type;
154 }
155
162 public function getCreatedAt()
163 {
164 if (is_null($this->createdAt)) {
166 $data = $this->raw(self::FIELD_CREATED_AT);
167 if (is_null($data)) {
168 return null;
169 }
170 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
171 if (false === $data) {
172 return null;
173 }
174 $this->createdAt = $data;
175 }
176
177 return $this->createdAt;
178 }
179
186 public function getData()
187 {
188 if (is_null($this->data)) {
190 $data = $this->raw(self::FIELD_DATA);
191 if (is_null($data)) {
192 return null;
193 }
194
196 }
197
198 return $this->data;
199 }
200
201
205 public function setId(?string $id): void
206 {
207 $this->id = $id;
208 }
209
213 public function setNotificationType(?string $notificationType): void
214 {
215 $this->notificationType = $notificationType;
216 }
217
221 public function setResourceType(?string $resourceType): void
222 {
223 $this->resourceType = $resourceType;
224 }
225
229 public function setCreatedAt(?DateTimeImmutable $createdAt): void
230 {
231 $this->createdAt = $createdAt;
232 }
233
238 {
239 $this->data = $data;
240 }
241
242
243 #[\ReturnTypeWillChange]
244 public function jsonSerialize()
245 {
246 $data = $this->toArray();
247 if (isset($data[Event::FIELD_CREATED_AT]) && $data[Event::FIELD_CREATED_AT] instanceof \DateTimeImmutable) {
248 $data[Event::FIELD_CREATED_AT] = $data[Event::FIELD_CREATED_AT]->setTimeZone(new \DateTimeZone('UTC'))->format('c');
249 }
250 return (object) $data;
251 }
252}
__construct(?string $id=null, ?string $notificationType=null, ?string $resourceType=null, ?DateTimeImmutable $createdAt=null, ?ImportContainerDeletedEventData $data=null, ?string $type=null)