Created
October 9, 2012 12:21
-
-
Save BinaryKitten/3858485 to your computer and use it in GitHub Desktop.
Module as Route in ZF2
This file contains 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 Application; | |
use Zend\Mvc\MvcEvent; | |
use Zend\Http\PhpEnvironment\Response; | |
class Module extends Response { | |
//BootstrapListenerInterface | |
public function onBootstrap(MvcEvent $event) { | |
$eventManager = $event->getTarget()->getEventManager(); | |
$this->setContent('Hello World'); | |
$eventManager->attach(MvcEvent::EVENT_ROUTE, array($this, 'onDispatch'), 1000); | |
} | |
public function onDispatch(MvcEvent $event) { | |
return $this->send(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment