Skip to content

Commit

Permalink
Skip route loading when not in HTTP environment
Browse files Browse the repository at this point in the history
For ZF2 applications loaded via CLI, the "literal" route does not
exists and therefor an exception is thrown. Explicitly check for
the HTTP environment to load the routes.
  • Loading branch information
Jurian Sluiman committed Mar 5, 2013
1 parent 6594e54 commit db9f761
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Module.php
Expand Up @@ -42,6 +42,7 @@
namespace Soflomo\Prototype;

use Zend\EventManager\EventInterface;
use Zend\Http\Request as HttpRequest;
use Zend\Loader;
use Zend\ModuleManager\Feature;

Expand Down Expand Up @@ -71,8 +72,12 @@ public function onBootstrap(EventInterface $e)
$app = $e->getApplication();
$sm = $app->getServiceManager();

if (!$app->getRequest() instanceof HttpRequest) {
return;
}

$config = $sm->get('config');
$config = $config['soflomo_prototype'];
$config = $config['soflomo_prototype'];
if (isset($config['pages']) && is_array($config['pages'])) {
$routes = array();

Expand Down

0 comments on commit db9f761

Please sign in to comment.