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 | * Make sure your $kernel implements CacheInvalidationInterface. |
||
43 | * |
||
44 | * @param CacheInvalidation $kernel The kernel raising with this event |
||
45 | * @param Request $request The request being processed |
||
46 | * @param Response $response The response, if available |
||
47 | */ |
||
48 | public function __construct(CacheInvalidation $kernel, Request $request, Response $response = null) |
||
54 | |||
55 | /** |
||
56 | * Get the cache kernel that raised this event. |
||
57 | * |
||
58 | * @return CacheInvalidation |
||
59 | */ |
||
60 | public function getKernel() |
||
64 | |||
65 | /** |
||
66 | * Get the request that is being processed. |
||
67 | * |
||
68 | * @return Request |
||
69 | */ |
||
70 | public function getRequest() |
||
74 | |||
75 | /** |
||
76 | * Events that occur after the response is created provide the default response. |
||
77 | * Event listeners can also set the response to make it available here. |
||
78 | * |
||
79 | * @return Response|null The response if one was set |
||
80 | */ |
||
81 | public function getResponse() |
||
85 | |||
86 | /** |
||
87 | * Sets a response to use instead of continuing to handle this request. |
||
88 | * |
||
89 | * Setting a response stops propagation of the event to further event handlers. |
||
90 | * |
||
91 | * @param Response $response |
||
92 | */ |
||
93 | public function setResponse(Response $response) |
||
99 | } |
||
100 |