| 148 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
/*
|
|
|
4 |
* This file is part of the Symfony package.
|
|
|
5 |
*
|
|
|
6 |
* (c) Fabien Potencier <fabien@symfony.com>
|
|
|
7 |
*
|
|
|
8 |
* For the full copyright and license information, please view the LICENSE
|
|
|
9 |
* file that was distributed with this source code.
|
|
|
10 |
*/
|
|
|
11 |
|
|
|
12 |
namespace Symfony\Component\HttpKernel;
|
|
|
13 |
|
|
|
14 |
use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent;
|
|
|
15 |
use Symfony\Component\HttpKernel\Event\ControllerEvent;
|
|
|
16 |
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
|
|
17 |
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;
|
|
|
18 |
use Symfony\Component\HttpKernel\Event\RequestEvent;
|
|
|
19 |
use Symfony\Component\HttpKernel\Event\ResponseEvent;
|
|
|
20 |
use Symfony\Component\HttpKernel\Event\TerminateEvent;
|
|
|
21 |
use Symfony\Component\HttpKernel\Event\ViewEvent;
|
|
|
22 |
|
|
|
23 |
/**
|
|
|
24 |
* Contains all events thrown in the HttpKernel component.
|
|
|
25 |
*
|
|
|
26 |
* @author Bernhard Schussek <bschussek@gmail.com>
|
|
|
27 |
*/
|
|
|
28 |
final class KernelEvents
|
|
|
29 |
{
|
|
|
30 |
/**
|
|
|
31 |
* The REQUEST event occurs at the very beginning of request
|
|
|
32 |
* dispatching.
|
|
|
33 |
*
|
|
|
34 |
* This event allows you to create a response for a request before any
|
|
|
35 |
* other code in the framework is executed.
|
|
|
36 |
*
|
|
|
37 |
* @Event("Symfony\Component\HttpKernel\Event\RequestEvent")
|
|
|
38 |
*/
|
|
|
39 |
public const REQUEST = 'kernel.request';
|
|
|
40 |
|
|
|
41 |
/**
|
|
|
42 |
* The EXCEPTION event occurs when an uncaught exception appears.
|
|
|
43 |
*
|
|
|
44 |
* This event allows you to create a response for a thrown exception or
|
|
|
45 |
* to modify the thrown exception.
|
|
|
46 |
*
|
|
|
47 |
* @Event("Symfony\Component\HttpKernel\Event\ExceptionEvent")
|
|
|
48 |
*/
|
|
|
49 |
public const EXCEPTION = 'kernel.exception';
|
|
|
50 |
|
|
|
51 |
/**
|
|
|
52 |
* The CONTROLLER event occurs once a controller was found for
|
|
|
53 |
* handling a request.
|
|
|
54 |
*
|
|
|
55 |
* This event allows you to change the controller that will handle the
|
|
|
56 |
* request.
|
|
|
57 |
*
|
|
|
58 |
* @Event("Symfony\Component\HttpKernel\Event\ControllerEvent")
|
|
|
59 |
*/
|
|
|
60 |
public const CONTROLLER = 'kernel.controller';
|
|
|
61 |
|
|
|
62 |
/**
|
|
|
63 |
* The CONTROLLER_ARGUMENTS event occurs once controller arguments have been resolved.
|
|
|
64 |
*
|
|
|
65 |
* This event allows you to change the arguments that will be passed to
|
|
|
66 |
* the controller.
|
|
|
67 |
*
|
|
|
68 |
* @Event("Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent")
|
|
|
69 |
*/
|
|
|
70 |
public const CONTROLLER_ARGUMENTS = 'kernel.controller_arguments';
|
|
|
71 |
|
|
|
72 |
/**
|
|
|
73 |
* The VIEW event occurs when the return value of a controller
|
|
|
74 |
* is not a Response instance.
|
|
|
75 |
*
|
|
|
76 |
* This event allows you to create a response for the return value of the
|
|
|
77 |
* controller.
|
|
|
78 |
*
|
|
|
79 |
* @Event("Symfony\Component\HttpKernel\Event\ViewEvent")
|
|
|
80 |
*/
|
|
|
81 |
public const VIEW = 'kernel.view';
|
|
|
82 |
|
|
|
83 |
/**
|
|
|
84 |
* The RESPONSE event occurs once a response was created for
|
|
|
85 |
* replying to a request.
|
|
|
86 |
*
|
|
|
87 |
* This event allows you to modify or replace the response that will be
|
|
|
88 |
* replied.
|
|
|
89 |
*
|
|
|
90 |
* @Event("Symfony\Component\HttpKernel\Event\ResponseEvent")
|
|
|
91 |
*/
|
|
|
92 |
public const RESPONSE = 'kernel.response';
|
|
|
93 |
|
|
|
94 |
/**
|
|
|
95 |
* The FINISH_REQUEST event occurs when a response was generated for a request.
|
|
|
96 |
*
|
|
|
97 |
* This event allows you to reset the global and environmental state of
|
|
|
98 |
* the application, when it was changed during the request.
|
|
|
99 |
*
|
|
|
100 |
* @Event("Symfony\Component\HttpKernel\Event\FinishRequestEvent")
|
|
|
101 |
*/
|
|
|
102 |
public const FINISH_REQUEST = 'kernel.finish_request';
|
|
|
103 |
|
|
|
104 |
/**
|
|
|
105 |
* The TERMINATE event occurs once a response was sent.
|
|
|
106 |
*
|
|
|
107 |
* This event allows you to run expensive post-response jobs.
|
|
|
108 |
*
|
|
|
109 |
* @Event("Symfony\Component\HttpKernel\Event\TerminateEvent")
|
|
|
110 |
*/
|
|
|
111 |
public const TERMINATE = 'kernel.terminate';
|
|
|
112 |
|
|
|
113 |
/**
|
|
|
114 |
* Event aliases.
|
|
|
115 |
*
|
|
|
116 |
* These aliases can be consumed by RegisterListenersPass.
|
|
|
117 |
*/
|
|
|
118 |
public const ALIASES = [
|
|
|
119 |
ControllerArgumentsEvent::class => self::CONTROLLER_ARGUMENTS,
|
|
|
120 |
ControllerEvent::class => self::CONTROLLER,
|
|
|
121 |
ResponseEvent::class => self::RESPONSE,
|
|
|
122 |
FinishRequestEvent::class => self::FINISH_REQUEST,
|
|
|
123 |
RequestEvent::class => self::REQUEST,
|
|
|
124 |
ViewEvent::class => self::VIEW,
|
|
|
125 |
ExceptionEvent::class => self::EXCEPTION,
|
|
|
126 |
TerminateEvent::class => self::TERMINATE,
|
|
|
127 |
];
|
|
|
128 |
}
|