Skip to content

Commit 34382a8

Browse files
authored
refactor: summit sponsorship created event dto (#462)
Signed-off-by: romanetar <roman_ag@hotmail.com>
1 parent 79cac0a commit 34382a8

File tree

1 file changed

+18
-11
lines changed

1 file changed

+18
-11
lines changed

app/Events/SponsorServices/SummitSponsorshipCreatedEventDTO.php

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,36 +19,42 @@ class SummitSponsorshipCreatedEventDTO
1919
{
2020
private int $id;
2121
private int $sponsor_id;
22-
private int $type_id;
23-
private string $type_name;
22+
private int $sponsorship_type_id;
23+
private int $summit_sponsorship_type_id;
24+
private string $sponsorship_type_name;
2425

2526
private int $summit_id;
2627

2728
public function __construct(
2829
int $id,
2930
int $sponsor_id,
30-
int $type_id,
31-
string $type_name,
31+
int $summit_sponsorship_type_id,
32+
int $sponsorship_type_id,
33+
string $sponsorship_type_name,
3234
int $summit_id,
3335
)
3436
{
3537
$this->id = $id;
3638
$this->sponsor_id = $sponsor_id;
37-
$this->type_id = $type_id;
38-
$this->type_name = $type_name;
39+
$this->summit_sponsorship_type_id = $summit_sponsorship_type_id;
40+
$this->sponsorship_type_id = $sponsorship_type_id;
41+
$this->sponsorship_type_name = $sponsorship_type_name;
3942
$this->summit_id = $summit_id;
4043
}
4144

4245
public static function fromSponsorship(SummitSponsorship $sponsorship): self
4346
{
44-
$sponsorship_type = $sponsorship->getType()->getType();
47+
$summit_sponsorship_type = $sponsorship->getType();
48+
$sponsorship_type = $summit_sponsorship_type->getType();
49+
$sponsor = $sponsorship->getSponsor();
4550

4651
return new self(
4752
$sponsorship->getId(),
48-
$sponsorship->getSponsor()->getId(),
53+
$sponsor->getId(),
54+
$summit_sponsorship_type->getId(),
4955
$sponsorship_type->getId(),
5056
$sponsorship_type->getName(),
51-
$sponsorship->getSponsor()->getSummitId()
57+
$sponsor->getSummitId()
5258
);
5359
}
5460

@@ -57,8 +63,9 @@ public function serialize(): array
5763
return [
5864
'id' => $this->id,
5965
'sponsor_id' => $this->sponsor_id,
60-
'type_id' => $this->type_id,
61-
'type_name' => $this->type_name,
66+
'summit_sponsorship_type_id' => $this->summit_sponsorship_type_id,
67+
'sponsorship_type_id' => $this->sponsorship_type_id,
68+
'sponsorship_type_name' => $this->sponsorship_type_name,
6269
'summit_id' => $this->summit_id,
6370
];
6471
}

0 commit comments

Comments
 (0)