made config required to fail earlier
[zf2.biz/application_blanche.git] / public / index.php
index f4bf164..f49a36c 100644 (file)
@@ -1,32 +1,12 @@
 <?php
-// Define application environment
-defined('APPLICATION_ENV')
-    || define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
+/**
+ * This makes our life easier when dealing with paths. Everything is relative
+ * to the application root now.
+ */
+chdir(dirname(__DIR__));
 
-// Ensure ZF is on the include path
-set_include_path(implode(PATH_SEPARATOR, array(
-    realpath(__DIR__ . '/../library/ZendFramework/library'),
-    get_include_path(),
-)));
+// Setup autoloading
+require 'init_autoloader.php';
 
-require_once 'Zend/Loader/AutoloaderFactory.php';
-Zend\Loader\AutoloaderFactory::factory(array('Zend\Loader\StandardAutoloader' => array()));
-
-$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_config)
-);
-
-// Get the merged config object
-$config = $moduleManager->getMergedConfig();
-
-// Create application, bootstrap, and run
-$bootstrap = new $config->bootstrap_class($config, $moduleManager);
-$application = new Zend\Mvc\Application;
-$bootstrap->bootstrap($application);
-$application->run()->send();
+// Run the application!
+Zend\Mvc\Application::init(include 'config/application.config.php')->run();