-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPreDtoMappingEvent.php
43 lines (35 loc) · 979 Bytes
/
PreDtoMappingEvent.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace Artyum\RequestDtoMapperBundle\Event;
use Artyum\RequestDtoMapperBundle\Attribute\Dto;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Contracts\EventDispatcher\Event;
/**
* This event is dispatched before the mapping is made, this allows you to alter all the passed objects,
* including the extracted data before it's mapped to the DTO.
*/
class PreDtoMappingEvent extends Event
{
public function __construct(private Request $request, private Dto $attribute, private object $subject, private array $data)
{
}
public function getRequest(): Request
{
return $this->request;
}
public function getAttribute(): Dto
{
return $this->attribute;
}
public function getSubject(): object
{
return $this->subject;
}
public function getData(): array
{
return $this->data;
}
public function setData(array $data): void
{
$this->data = $data;
}
}