From: Evan Coury Date: Mon, 21 Nov 2011 20:27:58 +0000 (-0700) Subject: Convert to singular path names and move ZF2 submodule X-Git-Url: http://git.inspyration.org/?a=commitdiff_plain;h=069c369af0d167f7bc1b359468f3136d50429747;p=zf2.biz%2Fapplication_blanche.git Convert to singular path names and move ZF2 submodule - s/configs/config - s/vendors/vendor - moved library/ZendFramework to vendor/ZendFramework, got rid of library/ - updated zf2 submodule - added config/autoload path with readme explaining the purpose - set up to glob for config/autoload/*.config.php --- diff --git a/.gitmodules b/.gitmodules index 80fc458..8f630ff 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "library/ZendFramework"] - path = library/ZendFramework +[submodule "vendor/ZendFramework"] + path = vendor/ZendFramework url = git://github.com/zendframework/zf2.git diff --git a/config/application.config.php b/config/application.config.php new file mode 100644 index 0000000..273ebbe --- /dev/null +++ b/config/application.config.php @@ -0,0 +1,15 @@ + array( + realpath(dirname(__DIR__) . '/module'), + realpath(dirname(__DIR__) . '/vendor'), + ), + 'modules' => array( + 'Application', + ), + 'module_listener_options' => array( + 'config_cache_enabled' => false, + 'cache_dir' => realpath(dirname(__DIR__) . '/data/cache'), + 'application_environment' => getenv('APPLICATION_ENV'), + ), +); diff --git a/config/autoload/README.md b/config/autoload/README.md new file mode 100644 index 0000000..a42ef5b --- /dev/null +++ b/config/autoload/README.md @@ -0,0 +1,8 @@ +About this directory: +===================== + +By default, this application is configured to load all configs in +`./config/autoload/*.config.php`. Doing this provides a location for a +developer to drop in configuration override files provided by modules, as well +as cleanly provide individual, application-wide config files for things like +database connections, etc. diff --git a/configs/application.config.php b/configs/application.config.php deleted file mode 100644 index b716191..0000000 --- a/configs/application.config.php +++ /dev/null @@ -1,14 +0,0 @@ - array( - realpath(__DIR__ . '/../modules'), - realpath(__DIR__ . '/../vendors'), - ), - 'modules' => array( - 'Application', - ), - 'module_listener_options' => array( - 'config_cache_enabled' => false, - 'cache_dir' => realpath(__DIR__ . '/../data/cache'), - ), -); diff --git a/library/ZendFramework b/library/ZendFramework deleted file mode 160000 index 9fdf610..0000000 --- a/library/ZendFramework +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 9fdf610f5e8bc3f6426753cee9a81efe5d0b5e53 diff --git a/module/.gitignore b/module/.gitignore new file mode 100644 index 0000000..84460e1 --- /dev/null +++ b/module/.gitignore @@ -0,0 +1,3 @@ +/* +!Application/ +!.gitignore diff --git a/module/Application/Module.php b/module/Application/Module.php new file mode 100644 index 0000000..5bd9a70 --- /dev/null +++ b/module/Application/Module.php @@ -0,0 +1,81 @@ +attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 100); + } + + public function getAutoloaderConfig() + { + return array( + 'Zend\Loader\ClassMapAutoloader' => array( + __DIR__ . '/autoload_classmap.php', + ), + 'Zend\Loader\StandardAutoloader' => array( + 'namespaces' => array( + __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, + ), + ), + ); + } + + public function getConfig($env = null) + { + return include __DIR__ . '/configs/module.config.php'; + } + + public function initializeView($e) + { + $app = $e->getParam('application'); + $locator = $app->getLocator(); + $config = $e->getParam('config'); + $view = $this->getView($app); + $viewListener = $this->getViewListener($view, $config); + $app->events()->attachAggregate($viewListener); + $events = StaticEventManager::getInstance(); + $viewListener->registerStaticListeners($events, $locator); + } + + protected function getViewListener($view, $config) + { + if ($this->viewListener instanceof View\Listener) { + return $this->viewListener; + } + + $viewListener = new View\Listener($view, $config->layout); + $viewListener->setDisplayExceptionsFlag($config->display_exceptions); + + $this->viewListener = $viewListener; + return $viewListener; + } + + protected function getView($app) + { + if ($this->view) { + return $this->view; + } + + $di = $app->getLocator(); + $view = $di->get('view'); + $url = $view->plugin('url'); + $url->setRouter($app->getRouter()); + + $view->plugin('headTitle')->setSeparator(' - ') + ->setAutoEscape(false) + ->append('Application'); + $this->view = $view; + return $view; + } +} diff --git a/module/Application/autoload_classmap.php b/module/Application/autoload_classmap.php new file mode 100644 index 0000000..a30d090 --- /dev/null +++ b/module/Application/autoload_classmap.php @@ -0,0 +1,7 @@ + __DIR__ . '/src/Application/View/Listener.php', + 'Application\Controller\IndexController' => __DIR__ . '/src/Application/Controller/IndexController.php', + 'Application\Controller\ErrorController' => __DIR__ . '/src/Application/Controller/ErrorController.php', + 'Application\Module' => __DIR__ . '/Module.php', +); \ No newline at end of file diff --git a/module/Application/autoload_function.php b/module/Application/autoload_function.php new file mode 100644 index 0000000..3ea81c4 --- /dev/null +++ b/module/Application/autoload_function.php @@ -0,0 +1,12 @@ + 'layouts/layout.phtml', + 'di' => array( + 'instance' => array( + 'alias' => array( + 'index' => 'Application\Controller\IndexController', + 'error' => 'Application\Controller\ErrorController', + 'view' => 'Zend\View\PhpRenderer', + ), + 'Zend\View\PhpRenderer' => array( + 'parameters' => array( + 'resolver' => 'Zend\View\TemplatePathStack', + 'options' => array( + 'script_paths' => array( + 'application' => __DIR__ . '/../views', + ), + ), + ), + ), + ), + ), + 'routes' => array( + 'default' => array( + 'type' => 'Zend\Mvc\Router\Http\Segment', + 'options' => array( + 'route' => '/[:controller[/:action]]', + 'constraints' => array( + 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', + 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', + ), + 'defaults' => array( + 'controller' => 'index', + 'action' => 'index', + ), + ), + ), + 'home' => array( + 'type' => 'Zend\Mvc\Router\Http\Literal', + 'options' => array( + 'route' => '/', + 'defaults' => array( + 'controller' => 'index', + 'action' => 'index', + ), + ), + ), + ), +); diff --git a/module/Application/src/Application/Controller/ErrorController.php b/module/Application/src/Application/Controller/ErrorController.php new file mode 100644 index 0000000..17f002e --- /dev/null +++ b/module/Application/src/Application/Controller/ErrorController.php @@ -0,0 +1,33 @@ +request->getMetadata('error', false); + if (!$error) { + $error = array( + 'type' => 404, + 'message' => 'Page not found', + ); + } + + switch ($error['type']) { + case self::ERROR_NO_ROUTE: + case self::ERROR_NO_CONTROLLER: + default: + // 404 error -- controller or action not found + $this->response->setStatusCode(404); + break; + } + + return array('message' => $error['message']); + } +} diff --git a/module/Application/src/Application/Controller/IndexController.php b/module/Application/src/Application/Controller/IndexController.php new file mode 100644 index 0000000..8c1f5e1 --- /dev/null +++ b/module/Application/src/Application/Controller/IndexController.php @@ -0,0 +1,13 @@ +view = $renderer; + $this->layout = $layout; + } + + public function setDisplayExceptionsFlag($flag) + { + $this->displayExceptions = (bool) $flag; + return $this; + } + + public function displayExceptions() + { + return $this->displayExceptions; + } + + public function attach(EventCollection $events) + { + $this->listeners[] = $events->attach('dispatch.error', array($this, 'renderError')); + $this->listeners[] = $events->attach('dispatch', array($this, 'render404'), -80); + $this->listeners[] = $events->attach('dispatch', array($this, 'renderLayout'), -1000); + } + + public function detach(EventCollection $events) + { + foreach ($this->listeners as $key => $listener) { + $events->detach($listener); + unset($this->listeners[$key]); + unset($listener); + } + } + + public function registerStaticListeners(StaticEventCollection $events, $locator) + { + $ident = 'Application\Controller\PageController'; + $handler = $events->attach($ident, 'dispatch', array($this, 'renderPageController'), -50); + $this->staticListeners[] = array($ident, $handler); + + $ident = 'Zend\Mvc\Controller\ActionController'; + $handler = $events->attach($ident, 'dispatch', array($this, 'renderView'), -50); + $this->staticListeners[] = array($ident, $handler); + } + + public function detachStaticListeners(StaticEventCollection $events) + { + foreach ($this->staticListeners as $i => $info) { + list($id, $handler) = $info; + $events->detach($id, $handler); + unset($this->staticListeners[$i]); + } + } + + public function renderPageController(MvcEvent $e) + { + $page = $e->getResult(); + if ($page instanceof Response) { + return; + } + + $response = $e->getResponse(); + if ($response->isNotFound()) { + return; + } + + $routeMatch = $e->getRouteMatch(); + + if (!$routeMatch) { + $page = '404'; + } else { + $page = $routeMatch->getParam('action', '404'); + } + + if ($page == '404') { + $response->setStatusCode(404); + } + + $script = 'pages/' . $page . '.phtml'; + + // Action content + $content = $this->view->render($script); + $e->setResult($content); + + return $this->renderLayout($e); + } + + public function renderView(MvcEvent $e) + { + $response = $e->getResponse(); + if (!$response->isSuccess()) { + return; + } + + $routeMatch = $e->getRouteMatch(); + $controller = $routeMatch->getParam('controller', 'index'); + $action = $routeMatch->getParam('action', 'index'); + $script = $controller . '/' . $action . '.phtml'; + + $vars = $e->getResult(); + if (is_scalar($vars)) { + $vars = array('content' => $vars); + } elseif (is_object($vars) && !$vars instanceof ArrayAccess) { + $vars = (array) $vars; + } + + $content = $this->view->render($script, $vars); + + $e->setResult($content); + return $content; + } + + public function renderLayout(MvcEvent $e) + { + $response = $e->getResponse(); + if (!$response) { + $response = new Response(); + $e->setResponse($response); + } + if ($response->isRedirect()) { + return $response; + } + + $footer = $e->getParam('footer', false); + $vars = array('footer' => $footer); + + if (false !== ($contentParam = $e->getParam('content', false))) { + $vars['content'] = $contentParam; + } else { + $vars['content'] = $e->getResult(); + } + + $layout = $this->view->render($this->layout, $vars); + $response->setContent($layout); + return $response; + } + + public function render404(MvcEvent $e) + { + $vars = $e->getResult(); + if ($vars instanceof Response) { + return; + } + + $response = $e->getResponse(); + if ($response->getStatusCode() != 404) { + // Only handle 404's + return; + } + + $vars = array( + 'message' => 'Page not found.', + 'exception' => $e->getParam('exception'), + 'display_exceptions' => $this->displayExceptions(), + ); + + $content = $this->view->render('pages/404.phtml', $vars); + + $e->setResult($content); + + return $this->renderLayout($e); + } + + public function renderError(MvcEvent $e) + { + $error = $e->getError(); + $app = $e->getTarget(); + $response = $e->getResponse(); + if (!$response) { + $response = new Response(); + $e->setResponse($response); + } + + switch ($error) { + case Application::ERROR_CONTROLLER_NOT_FOUND: + case Application::ERROR_CONTROLLER_INVALID: + $vars = array( + 'message' => 'Page not found.', + 'exception' => $e->getParam('exception'), + 'display_exceptions' => $this->displayExceptions(), + ); + $response->setStatusCode(404); + break; + + case Application::ERROR_EXCEPTION: + default: + $exception = $e->getParam('exception'); + $vars = array( + 'message' => 'An error occurred during execution; please try again later.', + 'exception' => $e->getParam('exception'), + 'display_exceptions' => $this->displayExceptions(), + ); + $response->setStatusCode(500); + break; + } + + $content = $this->view->render('error/index.phtml', $vars); + + $e->setResult($content); + + return $this->renderLayout($e); + } +} diff --git a/module/Application/views/error/index.phtml b/module/Application/views/error/index.phtml new file mode 100644 index 0000000..454b615 --- /dev/null +++ b/module/Application/views/error/index.phtml @@ -0,0 +1,14 @@ +

An error occurred

+

message ?>

+ +exception)): ?> + +

Exception information:

+

+ Message: exception->getMessage() ?> +

+ +

Stack trace:

+
exception->getTraceAsString() ?>
+ + diff --git a/module/Application/views/index/index.phtml b/module/Application/views/index/index.phtml new file mode 100644 index 0000000..e89aa33 --- /dev/null +++ b/module/Application/views/index/index.phtml @@ -0,0 +1,3 @@ +Module: Application » +Controller: Index » +Action: index diff --git a/module/Application/views/layouts/layout.phtml b/module/Application/views/layouts/layout.phtml new file mode 100644 index 0000000..5a1e9ea --- /dev/null +++ b/module/Application/views/layouts/layout.phtml @@ -0,0 +1,15 @@ +doctype() ?> + + + + + headTitle() ?> + headMeta() ?> + headLink() ?> + headScript() ?> + + + +raw('content'); ?> + + diff --git a/modules/.gitignore b/modules/.gitignore deleted file mode 100644 index 84460e1..0000000 --- a/modules/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/* -!Application/ -!.gitignore diff --git a/modules/Application/Module.php b/modules/Application/Module.php deleted file mode 100644 index 5bd9a70..0000000 --- a/modules/Application/Module.php +++ /dev/null @@ -1,81 +0,0 @@ -attach('bootstrap', 'bootstrap', array($this, 'initializeView'), 100); - } - - public function getAutoloaderConfig() - { - return array( - 'Zend\Loader\ClassMapAutoloader' => array( - __DIR__ . '/autoload_classmap.php', - ), - 'Zend\Loader\StandardAutoloader' => array( - 'namespaces' => array( - __NAMESPACE__ => __DIR__ . '/src/' . __NAMESPACE__, - ), - ), - ); - } - - public function getConfig($env = null) - { - return include __DIR__ . '/configs/module.config.php'; - } - - public function initializeView($e) - { - $app = $e->getParam('application'); - $locator = $app->getLocator(); - $config = $e->getParam('config'); - $view = $this->getView($app); - $viewListener = $this->getViewListener($view, $config); - $app->events()->attachAggregate($viewListener); - $events = StaticEventManager::getInstance(); - $viewListener->registerStaticListeners($events, $locator); - } - - protected function getViewListener($view, $config) - { - if ($this->viewListener instanceof View\Listener) { - return $this->viewListener; - } - - $viewListener = new View\Listener($view, $config->layout); - $viewListener->setDisplayExceptionsFlag($config->display_exceptions); - - $this->viewListener = $viewListener; - return $viewListener; - } - - protected function getView($app) - { - if ($this->view) { - return $this->view; - } - - $di = $app->getLocator(); - $view = $di->get('view'); - $url = $view->plugin('url'); - $url->setRouter($app->getRouter()); - - $view->plugin('headTitle')->setSeparator(' - ') - ->setAutoEscape(false) - ->append('Application'); - $this->view = $view; - return $view; - } -} diff --git a/modules/Application/autoload_classmap.php b/modules/Application/autoload_classmap.php deleted file mode 100644 index a30d090..0000000 --- a/modules/Application/autoload_classmap.php +++ /dev/null @@ -1,7 +0,0 @@ - __DIR__ . '/src/Application/View/Listener.php', - 'Application\Controller\IndexController' => __DIR__ . '/src/Application/Controller/IndexController.php', - 'Application\Controller\ErrorController' => __DIR__ . '/src/Application/Controller/ErrorController.php', - 'Application\Module' => __DIR__ . '/Module.php', -); \ No newline at end of file diff --git a/modules/Application/autoload_function.php b/modules/Application/autoload_function.php deleted file mode 100644 index 3ea81c4..0000000 --- a/modules/Application/autoload_function.php +++ /dev/null @@ -1,12 +0,0 @@ - 'layouts/layout.phtml', - 'di' => array( - 'instance' => array( - 'alias' => array( - 'index' => 'Application\Controller\IndexController', - 'error' => 'Application\Controller\ErrorController', - 'view' => 'Zend\View\PhpRenderer', - ), - 'Zend\View\PhpRenderer' => array( - 'parameters' => array( - 'resolver' => 'Zend\View\TemplatePathStack', - 'options' => array( - 'script_paths' => array( - 'application' => __DIR__ . '/../views', - ), - ), - ), - ), - ), - ), - 'routes' => array( - 'default' => array( - 'type' => 'Zend\Mvc\Router\Http\Segment', - 'options' => array( - 'route' => '/[:controller[/:action]]', - 'constraints' => array( - 'controller' => '[a-zA-Z][a-zA-Z0-9_-]*', - 'action' => '[a-zA-Z][a-zA-Z0-9_-]*', - ), - 'defaults' => array( - 'controller' => 'index', - 'action' => 'index', - ), - ), - ), - 'home' => array( - 'type' => 'Zend\Mvc\Router\Http\Literal', - 'options' => array( - 'route' => '/', - 'defaults' => array( - 'controller' => 'index', - 'action' => 'index', - ), - ), - ), - ), -); diff --git a/modules/Application/src/Application/Controller/ErrorController.php b/modules/Application/src/Application/Controller/ErrorController.php deleted file mode 100644 index 17f002e..0000000 --- a/modules/Application/src/Application/Controller/ErrorController.php +++ /dev/null @@ -1,33 +0,0 @@ -request->getMetadata('error', false); - if (!$error) { - $error = array( - 'type' => 404, - 'message' => 'Page not found', - ); - } - - switch ($error['type']) { - case self::ERROR_NO_ROUTE: - case self::ERROR_NO_CONTROLLER: - default: - // 404 error -- controller or action not found - $this->response->setStatusCode(404); - break; - } - - return array('message' => $error['message']); - } -} diff --git a/modules/Application/src/Application/Controller/IndexController.php b/modules/Application/src/Application/Controller/IndexController.php deleted file mode 100644 index 8c1f5e1..0000000 --- a/modules/Application/src/Application/Controller/IndexController.php +++ /dev/null @@ -1,13 +0,0 @@ -view = $renderer; - $this->layout = $layout; - } - - public function setDisplayExceptionsFlag($flag) - { - $this->displayExceptions = (bool) $flag; - return $this; - } - - public function displayExceptions() - { - return $this->displayExceptions; - } - - public function attach(EventCollection $events) - { - $this->listeners[] = $events->attach('dispatch.error', array($this, 'renderError')); - $this->listeners[] = $events->attach('dispatch', array($this, 'render404'), -80); - $this->listeners[] = $events->attach('dispatch', array($this, 'renderLayout'), -1000); - } - - public function detach(EventCollection $events) - { - foreach ($this->listeners as $key => $listener) { - $events->detach($listener); - unset($this->listeners[$key]); - unset($listener); - } - } - - public function registerStaticListeners(StaticEventCollection $events, $locator) - { - $ident = 'Application\Controller\PageController'; - $handler = $events->attach($ident, 'dispatch', array($this, 'renderPageController'), -50); - $this->staticListeners[] = array($ident, $handler); - - $ident = 'Zend\Mvc\Controller\ActionController'; - $handler = $events->attach($ident, 'dispatch', array($this, 'renderView'), -50); - $this->staticListeners[] = array($ident, $handler); - } - - public function detachStaticListeners(StaticEventCollection $events) - { - foreach ($this->staticListeners as $i => $info) { - list($id, $handler) = $info; - $events->detach($id, $handler); - unset($this->staticListeners[$i]); - } - } - - public function renderPageController(MvcEvent $e) - { - $page = $e->getResult(); - if ($page instanceof Response) { - return; - } - - $response = $e->getResponse(); - if ($response->isNotFound()) { - return; - } - - $routeMatch = $e->getRouteMatch(); - - if (!$routeMatch) { - $page = '404'; - } else { - $page = $routeMatch->getParam('action', '404'); - } - - if ($page == '404') { - $response->setStatusCode(404); - } - - $script = 'pages/' . $page . '.phtml'; - - // Action content - $content = $this->view->render($script); - $e->setResult($content); - - return $this->renderLayout($e); - } - - public function renderView(MvcEvent $e) - { - $response = $e->getResponse(); - if (!$response->isSuccess()) { - return; - } - - $routeMatch = $e->getRouteMatch(); - $controller = $routeMatch->getParam('controller', 'index'); - $action = $routeMatch->getParam('action', 'index'); - $script = $controller . '/' . $action . '.phtml'; - - $vars = $e->getResult(); - if (is_scalar($vars)) { - $vars = array('content' => $vars); - } elseif (is_object($vars) && !$vars instanceof ArrayAccess) { - $vars = (array) $vars; - } - - $content = $this->view->render($script, $vars); - - $e->setResult($content); - return $content; - } - - public function renderLayout(MvcEvent $e) - { - $response = $e->getResponse(); - if (!$response) { - $response = new Response(); - $e->setResponse($response); - } - if ($response->isRedirect()) { - return $response; - } - - $footer = $e->getParam('footer', false); - $vars = array('footer' => $footer); - - if (false !== ($contentParam = $e->getParam('content', false))) { - $vars['content'] = $contentParam; - } else { - $vars['content'] = $e->getResult(); - } - - $layout = $this->view->render($this->layout, $vars); - $response->setContent($layout); - return $response; - } - - public function render404(MvcEvent $e) - { - $vars = $e->getResult(); - if ($vars instanceof Response) { - return; - } - - $response = $e->getResponse(); - if ($response->getStatusCode() != 404) { - // Only handle 404's - return; - } - - $vars = array( - 'message' => 'Page not found.', - 'exception' => $e->getParam('exception'), - 'display_exceptions' => $this->displayExceptions(), - ); - - $content = $this->view->render('pages/404.phtml', $vars); - - $e->setResult($content); - - return $this->renderLayout($e); - } - - public function renderError(MvcEvent $e) - { - $error = $e->getError(); - $app = $e->getTarget(); - $response = $e->getResponse(); - if (!$response) { - $response = new Response(); - $e->setResponse($response); - } - - switch ($error) { - case Application::ERROR_CONTROLLER_NOT_FOUND: - case Application::ERROR_CONTROLLER_INVALID: - $vars = array( - 'message' => 'Page not found.', - 'exception' => $e->getParam('exception'), - 'display_exceptions' => $this->displayExceptions(), - ); - $response->setStatusCode(404); - break; - - case Application::ERROR_EXCEPTION: - default: - $exception = $e->getParam('exception'); - $vars = array( - 'message' => 'An error occurred during execution; please try again later.', - 'exception' => $e->getParam('exception'), - 'display_exceptions' => $this->displayExceptions(), - ); - $response->setStatusCode(500); - break; - } - - $content = $this->view->render('error/index.phtml', $vars); - - $e->setResult($content); - - return $this->renderLayout($e); - } -} diff --git a/modules/Application/views/error/index.phtml b/modules/Application/views/error/index.phtml deleted file mode 100644 index 454b615..0000000 --- a/modules/Application/views/error/index.phtml +++ /dev/null @@ -1,14 +0,0 @@ -

An error occurred

-

message ?>

- -exception)): ?> - -

Exception information:

-

- Message: exception->getMessage() ?> -

- -

Stack trace:

-
exception->getTraceAsString() ?>
- - diff --git a/modules/Application/views/index/index.phtml b/modules/Application/views/index/index.phtml deleted file mode 100644 index e89aa33..0000000 --- a/modules/Application/views/index/index.phtml +++ /dev/null @@ -1,3 +0,0 @@ -Module: Application » -Controller: Index » -Action: index diff --git a/modules/Application/views/layouts/layout.phtml b/modules/Application/views/layouts/layout.phtml deleted file mode 100644 index 5a1e9ea..0000000 --- a/modules/Application/views/layouts/layout.phtml +++ /dev/null @@ -1,15 +0,0 @@ -doctype() ?> - - - - - headTitle() ?> - headMeta() ?> - headLink() ?> - headScript() ?> - - - -raw('content'); ?> - - diff --git a/public/index.php b/public/index.php index 9c388be..767893c 100644 --- a/public/index.php +++ b/public/index.php @@ -1,19 +1,8 @@ array())); -$appConfig = include __DIR__ . '/../configs/application.config.php'; +$appConfig = include dirname(__DIR__) . '/config/application.config.php'; $moduleLoader = new Zend\Loader\ModuleAutoloader($appConfig['module_paths']); $moduleLoader->register(); @@ -21,10 +10,11 @@ $moduleLoader->register(); $moduleManager = new Zend\Module\Manager($appConfig['modules']); $listenerOptions = new Zend\Module\Listener\ListenerOptions($appConfig['module_listener_options']); $moduleManager->setDefaultListenerOptions($listenerOptions); +$moduleManager->getConfigListener()->addConfigGlobPath(dirname(__DIR__) . '/config/autoload/*.config.php'); $moduleManager->loadModules(); // Create application, bootstrap, and run -$bootstrap = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig()); -$application = new Zend\Mvc\Application; +$bootstrap = new Zend\Mvc\Bootstrap($moduleManager->getMergedConfig()); +$application = new Zend\Mvc\Application; $bootstrap->bootstrap($application); $application->run()->send(); diff --git a/vendor/.gitignore b/vendor/.gitignore new file mode 100644 index 0000000..e082ac7 --- /dev/null +++ b/vendor/.gitignore @@ -0,0 +1,3 @@ +/* +!README.md +!.gitignore diff --git a/vendor/README.md b/vendor/README.md new file mode 100644 index 0000000..29381b6 --- /dev/null +++ b/vendor/README.md @@ -0,0 +1 @@ +This `vendors/` directory is where third-party modules should be installed. diff --git a/vendors/.gitignore b/vendors/.gitignore deleted file mode 100644 index e082ac7..0000000 --- a/vendors/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -/* -!README.md -!.gitignore diff --git a/vendors/README.md b/vendors/README.md deleted file mode 100644 index 29381b6..0000000 --- a/vendors/README.md +++ /dev/null @@ -1 +0,0 @@ -This `vendors/` directory is where third-party modules should be installed.