-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostDtoValidationEvent.php
40 lines (33 loc) · 1.01 KB
/
PostDtoValidationEvent.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
<?php
namespace Artyum\RequestDtoMapperBundle\Event;
use Artyum\RequestDtoMapperBundle\Attribute\Dto;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Validator\ConstraintViolationListInterface;
use Symfony\Contracts\EventDispatcher\Event;
/**
* This event is dispatched once the validation is done. If the validation is enabled, this would be the last event that is dispatched before your controller is called.
*/
class PostDtoValidationEvent extends Event
{
public function __construct(
private Request $request, private Dto $attribute, private object $subject,
private ConstraintViolationListInterface $errors
) {
}
public function getRequest(): Request
{
return $this->request;
}
public function getAttribute(): Dto
{
return $this->attribute;
}
public function getSubject(): object
{
return $this->subject;
}
public function getErrors(): ConstraintViolationListInterface
{
return $this->errors;
}
}