X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=module%2FApplication%2FModule.php;h=2cc8fdb22a62cac2a798fdb2367fa409c22c4747;hb=425c15d47b7d608b56b0f4d79fafd1ab2e195d80;hp=5f9342686cc52d54e6f3cbb85ca4faaea28782e2;hpb=7889d92c1550c6122119815ad673d186fee4f415;p=zf2.biz%2Fapplication_blanche.git diff --git a/module/Application/Module.php b/module/Application/Module.php index 5f93426..2cc8fdb 100644 --- a/module/Application/Module.php +++ b/module/Application/Module.php @@ -2,25 +2,25 @@ namespace Application; -use Zend\Module\Manager, - Zend\EventManager\StaticEventManager, - Zend\Module\Consumer\AutoloaderProvider; +use Zend\Mvc\ModuleRouteListener; -class Module implements AutoloaderProvider +class Module { - public function init(Manager $moduleManager) + public function onBootstrap($e) { - $events = $moduleManager->events(); - $sharedEvents = $events->getSharedManager(); - $sharedEvents->attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 100); + $eventManager = $e->getApplication()->getEventManager(); + $moduleRouteListener = new ModuleRouteListener(); + $moduleRouteListener->attach($eventManager); + } + + public function getConfig() + { + return include __DIR__ . '/config/module.config.php'; } public function getAutoloaderConfig() { return array( - 'Zend\Loader\ClassMapAutoloader' => array( - __DIR__ . '/autoload_classmap.php', - ), 'Zend\Loader\StandardAutoloader' => array( 'namespaces' => array( __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, @@ -28,18 +28,4 @@ class Module implements AutoloaderProvider ), ); } - - public function getConfig() - { - return include __DIR__ . '/config/module.config.php'; - } - - public function initializeView($e) - { - $app = $e->getParam('application'); - $basePath = $app->getRequest()->getBasePath(); - $locator = $app->getLocator(); - $renderer = $locator->get('Zend\View\Renderer\PhpRenderer'); - $renderer->plugin('basePath')->setBasePath($basePath); - } }