Updated for new event-driven module manager
authorEvan Coury <me@evancoury.com>
Mon, 14 Nov 2011 17:32:14 +0000 (10:32 -0700)
committerEvan Coury <me@evancoury.com>
Mon, 14 Nov 2011 17:32:14 +0000 (10:32 -0700)
- ZF2 submodule updated
- Application module now uses getParam('config')
- Application module now makes use of AutoloaderProvider interface
- index.php updated to new module manager interface

configs/application.config.php
library/ZendFramework
modules/Application/Module.php
public/index.php

index 5f35e66..b716191 100644 (file)
@@ -7,11 +7,8 @@ return array(
     'modules' => array(
         'Application',
     ),
-    'module_manager_options' => array( 
-        'enable_config_cache'      => false,
+    'module_listener_options' => array( 
+        'config_cache_enabled'     => false,
         'cache_dir'                => realpath(__DIR__ . '/../data/cache'),
-        'enable_dependency_check'  => false,
-        'enable_auto_installation' => false,
-        'manifest_dir'             => realpath(__DIR__ . '/../data'),
     ),
 );
index 009f6ea..dd8426f 160000 (submodule)
@@ -1 +1 @@
-Subproject commit 009f6ea929602017a1cccf2c6e8a257f0b3d69c1
+Subproject commit dd8426fc451be263b747b151810780a5f1f21c60
index 37cb11f..5bd9a70 100644 (file)
@@ -4,23 +4,22 @@ namespace Application;
 
 use Zend\Module\Manager,
     Zend\EventManager\StaticEventManager,
-    Zend\Loader\AutoloaderFactory;
+    Zend\Module\Consumer\AutoloaderProvider;
 
-class Module
+class Module implements AutoloaderProvider
 {
     protected $view;
     protected $viewListener;
 
     public function init(Manager $moduleManager)
     {
-        $this->initAutoloader();
         $events = StaticEventManager::getInstance();
         $events->attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 100);
     }
 
-    protected function initAutoloader()
+    public function getAutoloaderConfig()
     {
-        AutoloaderFactory::factory(array(
+        return array(
             'Zend\Loader\ClassMapAutoloader' => array(
                 __DIR__ . '/autoload_classmap.php',
             ),
@@ -29,7 +28,7 @@ class Module
                     __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__,
                 ),
             ),
-        ));
+        );
     }
 
     public function getConfig($env = null)
@@ -41,7 +40,7 @@ class Module
     {
         $app          = $e->getParam('application');
         $locator      = $app->getLocator();
-        $config       = $e->getParam('modules')->getMergedConfig();
+        $config       = $e->getParam('config');
         $view         = $this->getView($app);
         $viewListener = $this->getViewListener($view, $config);
         $app->events()->attachAggregate($viewListener);
index 84f5f90..9c388be 100644 (file)
@@ -13,18 +13,18 @@ set_include_path(implode(PATH_SEPARATOR, array(
 require_once 'Zend/Loader/AutoloaderFactory.php';
 Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
 
-$appConfig = new Zend\Config\Config(include __DIR__ . '/../configs/application.config.php');
+$appConfig = include __DIR__ . '/../configs/application.config.php';
 
 $moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']);
 $moduleLoader->register();
 
-$moduleManager = new Zend\Module\Manager(
-    $appConfig['modules'],
-    new Zend\Module\ManagerOptions($appConfig['module_manager_options'])
-);
+$moduleManager = new Zend\Module\Manager($appConfig['modules']);
+$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
+$moduleManager->setDefaultListenerOptions($listenerOptions);
+$moduleManager->loadModules();
 
 // Create application, bootstrap, and run
-$bootstrap      = new Zend\Mvc\Bootstrap($moduleManager);
+$bootstrap      = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig());
 $application    = new Zend\Mvc\Application;
 $bootstrap->bootstrap($application);
 $application->run()->send();