Completed
Push — master ( 91fdab...75a7b9 )
by
unknown
13:37
created

Kunstmaan/AdminListBundle/Event/AdminListEvent.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
namespace Kunstmaan\AdminListBundle\Event;
4
5
use Symfony\Component\EventDispatcher\Event;
6
use Symfony\Component\Form\FormInterface;
7
use Symfony\Component\HttpFoundation\Request;
8
use Symfony\Component\HttpFoundation\Response;
9
10
class AdminListEvent extends Event
11
{
12
    /**
13
     * @var object
14
     */
15
    protected $entity;
16
17
    /**
18
     * @var FormInterface
19
     */
20
    protected $form;
21
22
    /**
23
     * @var Request
24
     */
25
    protected $request;
26
27
    /**
28
     * @var Response
29
     */
30
    protected $response;
31
32
    /**
33
     * AdminListEvent constructor.
34
     * @param object $entity
35
     * @param Request $request
36
     * @param FormInterface|null $form
37
     */
38
    public function __construct($entity, Request $request, FormInterface $form = null)
0 ignored issues
show
You have injected the Request via parameter $request. This is generally not recommended as there might be multiple instances during a request cycle (f.e. when using sub-requests). Instead, it is recommended to inject the RequestStack and retrieve the current request each time you need it via getCurrentRequest().
Loading history...
39
    {
40
        $this->entity = $entity;
41
        $this->request = $request;
42
        $this->form = $form;
43
    }
44
45
    /**
46
     * @return object
47
     */
48
    public function getEntity()
49
    {
50
        return $this->entity;
51
    }
52
53
    /**
54
     * @return Request
55
     */
56
    public function getRequest()
57
    {
58
        return $this->request;
59
    }
60
61
    /**
62
     * @return FormInterface|null
63
     */
64
    public function getForm()
65
    {
66
        return $this->form;
67
    }
68
69
    /**
70
     * @return Response
71
     */
72
    public function getResponse()
73
    {
74
        return $this->response;
75
    }
76
77
    /**
78
     * Sets a response and stops event propagation.
79
     *
80
     * @param Response $response
81
     */
82
    public function setResponse(Response $response)
83
    {
84
        $this->response = $response;
85
86
        $this->stopPropagation();
87
    }
88
}
89