X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=public%2Findex.php;h=f347d342f402e9e4cf42dddfca16b5a074656d7a;hb=3b4e0e485233d44ee3a247bf34c1ca1bfd276c90;hp=34d0b34d7602317247ea593357f7e226e35f8abc;hpb=25971d5c84aa8bc53925d4e30f4e18401d7762fe;p=zf2.biz%2Fgalerie.git diff --git a/public/index.php b/public/index.php index 34d0b34..f347d34 100644 --- a/public/index.php +++ b/public/index.php @@ -1,24 +1,40 @@ add('Zend', $zf2Path . '/Zend'); + } else { + include $zf2Path . '/Zend/Loader/AutoloaderFactory.php'; + AutoloaderFactory::factory(array( + 'Zend\Loader\StandardAutoloader' => array( + 'autoregister_zf' => true + ) + )); + } } -$appConfig = include 'config/application.config.php'; +if (!class_exists('Zend\Loader\AutoloaderFactory')) { + throw new RuntimeException('Unable to load ZF2. Run `php composer.phar install` or define a ZF2_PATH environment variable.'); +} -$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); -$defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions); -$defaultListeners->getConfigListener()->addConfigGlobPath("config/autoload/*.{global,$env}..configphp"); +// Get application stack configuration +$configuration = include 'config/application.config.php'; -$moduleManager = new Zend\Module\Manager($appConfig['modules']); -$moduleManager->events()->attachAggregate($defaultListeners); -$moduleManager->loadModules(); +// Setup service manager +$serviceManager = new ServiceManager(new ServiceManagerConfiguration($configuration['service_manager'])); +$serviceManager->setService('ApplicationConfiguration', $configuration); +$serviceManager->get('ModuleManager')->loadModules(); -// Create application, bootstrap, and run -$bootstrap = new Zend\Mvc\Bootstrap($defaultListeners->getConfigListener()->getMergedConfig()); -$application = new Zend\Mvc\Application; -$bootstrap->bootstrap($application); -$application->run()->send(); +// Run application +$serviceManager->get('Application')->bootstrap()->run()->send();