Skip to content

Instantly share code, notes, and snippets.

@coreymcmahon
Created June 14, 2012 11:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coreymcmahon/2929672 to your computer and use it in GitHub Desktop.
Save coreymcmahon/2929672 to your computer and use it in GitHub Desktop.
Telling the Event Dispatcher when the 'response' Event has occurred - http://www.symfonycentral.com
<?php
namespace Simplex;
// ... etc
use Symfony\Component\EventDispatcher\EventDispatcher;
class Framework
{
// ... etc
public function __construct(EventDispatcher $dispatcher, UrlMatcherInterface $matcher, ControllerResolverInterface $resolver)
{
$this->matcher = $matcher;
$this->resolver = $resolver;
$this->dispatcher = $dispatcher;
}
public function handle(Request $request)
{
// ... do stuff
$this->dispatcher->dispatch('response', new ResponseEvent($response, $request));
return $response;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment