1 | <?php |
||
24 | class CacheEvent extends Event |
||
25 | { |
||
26 | /** |
||
27 | * @var CacheInvalidation |
||
28 | */ |
||
29 | private $kernel; |
||
30 | |||
31 | /** |
||
32 | * @var Request |
||
33 | */ |
||
34 | private $request; |
||
35 | |||
36 | /** |
||
37 | * @var Response |
||
38 | */ |
||
39 | private $response; |
||
40 | |||
41 | /** |
||
42 | * @var int |
||
43 | */ |
||
44 | private $requestType; |
||
45 | |||
46 | /** |
||
47 | * Make sure your $kernel implements CacheInvalidationInterface. |
||
48 | 41 | * |
|
49 | * @param CacheInvalidation $kernel the kernel raising with this event |
||
50 | 41 | * @param Request $request the request being processed |
|
51 | 41 | * @param Response $response the response, if available |
|
52 | 41 | * @param int $requestType the request type (default HttpKernelInterface::MASTER_REQUEST) |
|
53 | 41 | */ |
|
54 | public function __construct(CacheInvalidation $kernel, Request $request, Response $response = null, $requestType = HttpKernelInterface::MASTER_REQUEST) |
||
61 | |||
62 | 19 | /** |
|
63 | * Get the cache kernel that raised this event. |
||
64 | * |
||
65 | * @return CacheInvalidation |
||
66 | */ |
||
67 | public function getKernel() |
||
71 | |||
72 | 31 | /** |
|
73 | * Get the request that is being processed. |
||
74 | * |
||
75 | * @return Request |
||
76 | */ |
||
77 | public function getRequest() |
||
81 | 40 | ||
82 | /** |
||
83 | 40 | * One of the constants HttpKernelInterface::MASTER_REQUEST or SUB_REQUEST. |
|
84 | * |
||
85 | * @return int |
||
86 | */ |
||
87 | public function getRequestType() |
||
91 | |||
92 | /** |
||
93 | 14 | * Events that occur after the response is created provide the default response. |
|
94 | * Event listeners can also set the response to make it available here. |
||
95 | 14 | * |
|
96 | * @return Response|null the response if one was set |
||
97 | 14 | */ |
|
98 | 14 | public function getResponse() |
|
102 | |||
103 | /** |
||
104 | * Sets a response to use instead of continuing to handle this request. |
||
105 | * |
||
106 | * Setting a response stops propagation of the event to further event handlers. |
||
107 | * |
||
108 | * @param Response $response |
||
109 | */ |
||
110 | public function setResponse(Response $response) |
||
116 | } |
||
117 |