Skip to content

Commit

Permalink
Fix mapping issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Edinger committed Oct 25, 2024
1 parent 4b5d343 commit fa31367
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/StaticMappers/Vouchers/PromotionMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@ class PromotionMapper
{
public static function map($data): Promotion
{
if (is_array($data->attributes)) {
$attributes = $data->attributes;
} else {
$attributes = get_object_vars($data->attributes);
}

return new Promotion(
$data->uuid,
$data->name,
$data->description,
$data->voucher_limit ?? null,
$data->limit_per_contact ?? null,
$data->expiration_duration ?? null,
isset($data->attributes) ? get_object_vars($data->attributes) : []
isset($data->attributes) ? $attributes : []
);
}
}

0 comments on commit fa31367

Please sign in to comment.