Completed
Pull Request — 5.6 (#2830)
by Jeroen
14:14
created

Kunstmaan/AdminListBundle/Event/AdminListEvent.php (2 issues)

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
     *
35
     * @param object $entity
36
     */
37 1
    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...
38
    {
39 1
        $this->entity = $entity;
40 1
        $this->request = $request;
41 1
        $this->form = $form;
42 1
    }
43
44
    /**
45
     * @return object
46
     */
47 1
    public function getEntity()
48
    {
49 1
        return $this->entity;
50
    }
51
52
    /**
53
     * @return Request
54
     */
55 1
    public function getRequest()
56
    {
57 1
        return $this->request;
58
    }
59
60
    /**
61
     * @return FormInterface|null
62
     */
63 1
    public function getForm()
64
    {
65 1
        return $this->form;
66
    }
67
68
    /**
69
     * @return Response
70
     */
71 1
    public function getResponse()
72
    {
73 1
        return $this->response;
74
    }
75
76
    /**
77
     * Sets a response and stops event propagation.
78
     */
79 1
    public function setResponse(Response $response)
80
    {
81 1
        $this->response = $response;
82
83 1
        $this->stopPropagation();
0 ignored issues
show
Deprecated Code introduced by
The method Symfony\Component\EventD...vent::stopPropagation() has been deprecated with message: since Symfony 4.3, use "Symfony\Contracts\EventDispatcher\Event" instead

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
84 1
    }
85
}
86