Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5953 use kernel events constants #6591

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion components/event_dispatcher/container_aware_dispatcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,15 @@ 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
{
public static function getSubscribedEvents()
{
return array(
'kernel.response' => array(
KernelEvents::RESPONSE => array(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add the correct use statement on line 71

array('onKernelResponsePre', 10),
array('onKernelResponsePost', 0),
),
Expand All @@ -98,3 +99,4 @@ The ``EventSubscriberInterface`` is exactly as you would expect::
// ...
}
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line should be removed

Copy link
Author

@snoek09 snoek09 May 21, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my editor complained that it was needed; blank line is required after literal block

3 changes: 2 additions & 1 deletion cookbook/event_dispatcher/event_listener.rst
Original file line number Diff line number Diff line change
Expand Up @@ -142,14 +142,15 @@ 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
{
public static function getSubscribedEvents()
{
// 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),
Expand Down
5 changes: 3 additions & 2 deletions create_framework/http_kernel_httpkernel_class.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand All @@ -166,7 +167,7 @@ only if needed::

public static function getSubscribedEvents()
{
return array('kernel.view' => 'onView');
return array(KernelEvents::VIEW => 'onView');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add this use statement as well.

}
}

Expand Down