made config required to fail earlier
[zf2.biz/application_blanche.git] / public / index.php
index b8dc353..f49a36c 100644 (file)
@@ -1,20 +1,12 @@
 <?php
+/**
+ * This makes our life easier when dealing with paths. Everything is relative
+ * to the application root now.
+ */
 chdir(dirname(__DIR__));
-require_once 'vendor/ZendFramework/library/Zend/Loader/AutoloaderFactory.php';
-Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
 
-$appConfig = include 'config/application.config.php';
+// Setup autoloading
+require 'init_autoloader.php';
 
-$moduleManager    = new Zend\Module\Manager($appConfig['modules']);
-$listenerOptions  = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']);
-$defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions);
-
-$defaultListeners->getConfigListener()->addConfigGlobPath('config/autoload/*.config.php');
-$moduleManager->events()->attachAggregate($defaultListeners);
-$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 the application!
+Zend\Mvc\Application::init(include 'config/application.config.php')->run();