Created
June 14, 2012 11:07
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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