Skip to content

Commit 2ad294d

Browse files
committed
fix(domain-events): add extra info for sponsor add on Domain events
1 parent a87252f commit 2ad294d

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

app/Events/SponsorServices/SummitSponsorshipAddOnCreatedEventDTO.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ class SummitSponsorshipAddOnCreatedEventDTO
1919
{
2020
private int $id;
2121
private int $sponsorship_id;
22+
23+
private int $summit_sponsorship_type_id;
24+
private int $sponsorship_type_id;
25+
private string $sponsorship_type_name;
2226
private string $type;
2327
private string $name;
2428

@@ -29,6 +33,9 @@ class SummitSponsorshipAddOnCreatedEventDTO
2933
public function __construct(
3034
int $id,
3135
int $sponsorship_id,
36+
int $summit_sponsorship_type_id,
37+
int $sponsorship_type_id,
38+
string $sponsorship_type_name,
3239
string $type,
3340
string $name,
3441
int $sponsor_id,
@@ -37,6 +44,9 @@ public function __construct(
3744
{
3845
$this->id = $id;
3946
$this->sponsorship_id = $sponsorship_id;
47+
$this->summit_sponsorship_type_id = $summit_sponsorship_type_id;
48+
$this->sponsorship_type_id = $sponsorship_type_id;
49+
$this->sponsorship_type_name = $sponsorship_type_name;
4050
$this->type = $type;
4151
$this->name = $name;
4252
$this->sponsor_id = $sponsor_id;
@@ -45,9 +55,16 @@ public function __construct(
4555

4656
public static function fromSponsorshipAddOn(SummitSponsorshipAddOn $add_on): self
4757
{
58+
$sponsorship = $add_on->getSponsorship();
59+
$summit_sponsorship_type = $sponsorship->getType();
60+
$sponsorship_type = $summit_sponsorship_type->getType();
61+
4862
return new self(
4963
$add_on->getId(),
50-
$add_on->getSponsorship()->getId(),
64+
$sponsorship->getId(),
65+
$summit_sponsorship_type->getId(),
66+
$sponsorship_type->getId(),
67+
$sponsorship_type->getName(),
5168
$add_on->getType(),
5269
$add_on->getName(),
5370
$add_on->getSponsorship()->getSponsor()->getId(),
@@ -61,9 +78,13 @@ public function serialize(): array
6178
'id' => $this->id,
6279
'type' => $this->type,
6380
'name' => $this->name,
64-
'sponsorship_id' => $this->sponsorship_id,
6581
'sponsor_id' => $this->sponsor_id,
6682
'summit_id' => $this->summit_id,
83+
'sponsorship_id' => $this->sponsorship_id,
84+
// add extra info in order to be able to recreate missing sponsorship
85+
'summit_sponsorship_type_id' => $this->summit_sponsorship_type_id,
86+
'sponsorship_type_id' => $this->sponsorship_type_id,
87+
'sponsorship_type_name' => $this->sponsorship_type_name,
6788
];
6889
}
6990
}

0 commit comments

Comments
 (0)