X-Git-Url: http://git.inspyration.org/?a=blobdiff_plain;f=public%2Findex.php;h=34c609d405670e9f3bff78a8701a27df74b243e0;hb=b512f01381ad277ba0d16d8404eb93aff260b8a6;hp=9c388bef43491949dcb20255d8ca971669a12f17;hpb=a4421c44d9026edfe0c462f8e13cc8234efa401a;p=zf2.biz%2Fgalerie.git diff --git a/public/index.php b/public/index.php index 9c388be..34c609d 100644 --- a/public/index.php +++ b/public/index.php @@ -1,30 +1,24 @@ array())); +if (!file_exists('vendor/autoload.php')) { + throw new RuntimeException('vendor/autoload.php could not be found. Did you run php composer.phar install?'); + exit; +} -$appConfig = include __DIR__ . '/../configs/application.config.php'; +// Composer autoloading +require_once('vendor/autoload.php'); -$moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']); -$moduleLoader->register(); +// Get application stack configuration. +$configuration = include 'config/application.config.php'; -$moduleManager = new Zend\Module\Manager($appConfig['modules']); -$listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); -$moduleManager->setDefaultListenerOptions($listenerOptions); -$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($moduleManager->getMergedConfig()); -$application = new Zend\Mvc\Application; -$bootstrap->bootstrap($application); -$application->run()->send(); +// Run application. +$serviceManager->get('Application')->bootstrap()->run()->send();