3declare(strict_types=1);
124 if (is_null($this->code)) {
126 $data = $this->
raw(self::FIELD_CODE);
127 if (is_null($data)) {
130 $this->code = (string) $data;
144 if (is_null($this->message)) {
146 $data = $this->
raw(self::FIELD_MESSAGE);
147 if (is_null($data)) {
150 $this->message = (string) $data;
164 if (is_null($this->sku)) {
166 $data = $this->
raw(self::FIELD_SKU);
167 if (is_null($data)) {
170 $this->sku = (string) $data;
184 if (is_null($this->currency)) {
186 $data = $this->
raw(self::FIELD_CURRENCY);
187 if (is_null($data)) {
190 $this->currency = (string) $data;
204 if (is_null($this->country)) {
206 $data = $this->
raw(self::FIELD_COUNTRY);
207 if (is_null($data)) {
210 $this->country = (string) $data;
224 if (is_null($this->customerGroup)) {
226 $data = $this->
raw(self::FIELD_CUSTOMER_GROUP);
227 if (is_null($data)) {
231 $this->customerGroup = CustomerGroupResourceIdentifierModel::of($data);
245 if (is_null($this->channel)) {
247 $data = $this->
raw(self::FIELD_CHANNEL);
248 if (is_null($data)) {
252 $this->channel = ChannelResourceIdentifierModel::of($data);
266 if (is_null($this->validFrom)) {
268 $data = $this->
raw(self::FIELD_VALID_FROM);
269 if (is_null($data)) {
272 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
273 if (
false === $data) {
276 $this->validFrom = $data;
290 if (is_null($this->validUntil)) {
292 $data = $this->
raw(self::FIELD_VALID_UNTIL);
293 if (is_null($data)) {
296 $data = DateTimeImmutable::createFromFormat(MapperFactory::DATETIME_FORMAT, $data);
297 if (
false === $data) {
300 $this->validUntil = $data;
314 if (is_null($this->recurrencePolicy)) {
316 $data = $this->
raw(self::FIELD_RECURRENCE_POLICY);
317 if (is_null($data)) {
321 $this->recurrencePolicy = RecurrencePolicyReferenceModel::of($data);
403 public function by(
string $key)
405 $data = $this->
raw($key);
406 if (is_null($data)) {
413 #[\ReturnTypeWillChange]
424 return (
object) $data;