diff --git a/components/event_dispatcher/container_aware_dispatcher.rst b/components/event_dispatcher/container_aware_dispatcher.rst index c73d249c994..2592c19a787 100644 --- a/components/event_dispatcher/container_aware_dispatcher.rst +++ b/components/event_dispatcher/container_aware_dispatcher.rst @@ -68,6 +68,7 @@ and the second argument is the service's class name (which must implement The ``EventSubscriberInterface`` is exactly as you would expect:: use Symfony\Component\EventDispatcher\EventSubscriberInterface; + use Symfony\Component\HttpKernel\KernelEvents; // ... class StoreSubscriber implements EventSubscriberInterface @@ -75,7 +76,7 @@ The ``EventSubscriberInterface`` is exactly as you would expect:: public static function getSubscribedEvents() { return array( - 'kernel.response' => array( + KernelEvents::RESPONSE => array( array('onKernelResponsePre', 10), array('onKernelResponsePost', 0), ), @@ -98,3 +99,4 @@ The ``EventSubscriberInterface`` is exactly as you would expect:: // ... } } + diff --git a/cookbook/event_dispatcher/event_listener.rst b/cookbook/event_dispatcher/event_listener.rst index 4a8f263ff29..1e86e8cc8b7 100644 --- a/cookbook/event_dispatcher/event_listener.rst +++ b/cookbook/event_dispatcher/event_listener.rst @@ -142,6 +142,7 @@ listen to the same ``kernel.exception`` event:: use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; + use Symfony\Component\HttpKernel\KernelEvents; class ExceptionSubscriber implements EventSubscriberInterface { @@ -149,7 +150,7 @@ listen to the same ``kernel.exception`` event:: { // return the subscribed events, their methods and priorities return array( - 'kernel.exception' => array( + KernelEvents::EXCEPTION => array( array('processException', 10), array('logException', 0), array('notifyException', -10), diff --git a/create_framework/http_kernel_httpkernel_class.rst b/create_framework/http_kernel_httpkernel_class.rst index be2a2c7a09f..a6c91ec2506 100644 --- a/create_framework/http_kernel_httpkernel_class.rst +++ b/create_framework/http_kernel_httpkernel_class.rst @@ -150,8 +150,9 @@ only if needed:: namespace Simplex; use Symfony\Component\EventDispatcher\EventSubscriberInterface; - use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpFoundation\Response; + use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; + use Symfony\Component\HttpKernel\KernelEvents; class StringResponseListener implements EventSubscriberInterface { @@ -166,7 +167,7 @@ only if needed:: public static function getSubscribedEvents() { - return array('kernel.view' => 'onView'); + return array(KernelEvents::VIEW => 'onView'); } }