8000 5953 use kernel events constants · symfony/symfony-docs@ad0e377 · GitHub
[go: up one dir, main page]

Skip to content

Commit ad0e377

Browse files
Henry Snoekwouterj
Henry Snoek
authored andcommitted
5953 use kernel events constants
1 parent 7a3eca6 commit ad0e377

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

components/event_dispatcher/container_aware_dispatcher.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,15 @@ and the second argument is the service's class name (which must implement
6868
The ``EventSubscriberInterface`` is exactly as you would expect::
6969

7070
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
71+
use Symfony\Component\HttpKernel\KernelEvents;
7172
// ...
7273

7374
class StoreSubscriber implements EventSubscriberInterface
7475
{
7576
public static function getSubscribedEvents()
7677
{
7778
return array(
78-
'kernel.response' => array(
79+
KernelEvents::RESPONSE => array(
7980
array('onKernelResponsePre', 10),
8081
array('onKernelResponsePost', 0),
8182
),
@@ -98,3 +99,4 @@ The ``EventSubscriberInterface`` is exactly as you would expect::
9899
// ...
99100
}
100101
}
102+

cookbook/event_dispatcher/event_listener.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,14 +142,15 @@ listen to the same ``kernel.exception`` event::
142142

143143
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
144144
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;
145+
use Symfony\Component\HttpKernel\KernelEvents;
145146

146147
class ExceptionSubscriber implements EventSubscriberInterface
147148
{
148149
public static function getSubscribedEvents()
149150
{
150151
// return the subscribed events, their methods and priorities
151152
return array(
152-
'kernel.exception' => array(
153+
KernelEvents::EXCEPTION => array(
153154
array('processException', 10),
154155
array('logException', 0),
155156
array('notifyException', -10),

create_framework/http_kernel_httpkernel_class.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ only if needed::
150150
namespace Simplex;
151151

152152
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
153-
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
154153
use Symfony\Component\HttpFoundation\Response;
154+
use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent;
155+
use Symfony\Component\HttpKernel\KernelEvents;
155156

156157
class StringResponseListener implements EventSubscriberInterface
157158
{
@@ -166,7 +167,7 @@ only if needed::
166167

167168
public static function getSubscribedEvents()
168169
{
169-
return array('kernel.view' => 'onView');
170+
return array(KernelEvents::VIEW => 'onView');
170171
}
171172
}
172173

0 commit comments

Comments
 (0)
0