<?php chdir(dirname(__DIR__)); require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(); $appConfig = (include 'config/application.config.php'); $sharedEvents = new Zend\EventManager\SharedEventManager(); $listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); $defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions); $defaultListeners->getConfigListener()->addConfigGlobPath("config/autoload/*.php"); $moduleManager = new Zend\Module\Manager($appConfig['modules']); $events = $moduleManager->events(); $events->setSharedManager($sharedEvents); $events->attach($defaultListeners); $moduleManager->loadModules(); // Create application, bootstrap, and run $bootstrap = new Zend\Mvc\Bootstrap($defaultListeners->getConfigListener()->getMergedConfig()); $bootstrap->events()->setSharedManager($sharedEvents); $application = new Zend\Mvc\Application(); $bootstrap->bootstrap($application); $application->run()->send();
<?php chdir(__DIR__); $path = dirname(__DIR__); require_once "{$path}/vendor/ZendFramework/library/Zend/Loader/AutoloaderFactory.php"; Zend\Loader\AutoloaderFactory::factory(); $appConfig = (include "{$path}/config/application.config.php"); $listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); $defaultListeners = new Zend\Module\Listener\DefaultListenerAggregate($listenerOptions); $defaultListeners->getConfigListener()->addConfigGlobPath("{$path}/config/autoload/*.config.php"); $moduleManager = new Zend\Module\Manager($appConfig['modules']); $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();
<?php ini_set('display_errors', true); chdir(__DIR__); $previousDir = '.'; while (!file_exists('config/application.config.php')) { $dir = dirname(getcwd()); if ($previousDir === $dir) { throw new RuntimeException('Unable to locate "config/application.config.php":' . ' is DoctrineModule in a subdir of your application skeleton?'); } $previousDir = $dir; chdir($dir); } require_once (getenv('ZF2_PATH') ?: 'vendor/ZendFramework/library') . '/Zend/Loader/AutoloaderFactory.php'; Zend\Loader\AutoloaderFactory::factory(); $appConfig = (include 'config/application.config.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/{,*.}{global,local}.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->getLocator()->get('doctrine_cli')->run();