title: Zend Framework 2 Navigation's exception
body: <p>I was looking for show a navigation menu in the layout.phtml file:</p>
  
  <pre><code>&lt;?php echo $this-&gt;navigation('navigation')-&gt;menu(); ?&gt;
  </code></pre>
  
  <p>So, I added these lines to /module/Application/config/module.config.php in order to declare the menu's structure according to my app routes:</p>
  
  <pre><code>'navigation' =&gt; array(
          'default' =&gt; array(
              'place' =&gt; array(
                  'label' =&gt; 'Places',
                  'route' =&gt; '/place',
                  'pages' =&gt; array(
                      'country' =&gt; array(
                          'label' =&gt; 'Countries',
                          'route' =&gt; '/place/country',
                      ),
                      'state' =&gt; array(
                          'label' =&gt; 'States',
                          'route' =&gt; '/place/state',
                      ),
                      'city' =&gt; array(
                          'label' =&gt; 'Cities',
                          'route' =&gt; '/place/city',
                      ),
                  ),
              ),
          ),
       ),
  </code></pre>
  
  <p>and then I wrote a loader for the Zend/Navigation instance:</p>
  
  <pre><code>'service_manager' =&gt; array(
          'factories' =&gt; array(
              'translator' =&gt; 'Zend\I18n\Translator\TranslatorServiceFactory',
              'navigation' =&gt; 'Zend\Navigation\Service\DefaultNavigationFactory',
          ),
      ),
  </code></pre>
  
  <p>but I get repeatedly this exception:</p>
  
  <blockquote>
    <p>Fatal error: Zend\Mvc\Router\Exception\RuntimeException: Route with
    name "" not found in
    C:\wamp\www\bsol\vendor\zendframework\zendframework\library\Zend\View\Helper\Navigation\AbstractHelper.php
    on line 471</p>
  </blockquote>
  
  <p>I attempted to solve the problem adding this line to the menu declaration:</p>
  
  <pre><code>             'pages' =&gt; array(
                      'route' =&gt; '/place',
                      'country' =&gt; array(
                          'label' =&gt; 'Countries',
                          'route' =&gt; '/place/country',
                      ),
  </code></pre>
  
  <p>Nevertheless, In that case I get another different exception:</p>
  
  <blockquote>
    <p>Fatal error: Uncaught exception
    'Zend\Navigation\Exception\InvalidArgumentException' with message
    'Invalid argument: $page must be an instance of
    Zend\Navigation\Page\AbstractPage or Traversable, or an array' in
    C:\wamp\www\bsol\vendor\zendframework\zendframework\library\Zend\ServiceManager\ServiceManager.php
    on line 733</p>
  </blockquote>
  
  <p>UPDATED: Following Jurian Sluiman's suggestion,</p>
  
  <p>This must be my router configuration (module\Place\config\module.config.php), if I've got a module called 'Place', with 3 controllers (city, country and state):</p>
  
  <pre><code>'router' =&gt; array(
          'routes' =&gt; array(
              'city' =&gt; array(
                  'type'    =&gt; 'segment',
                  'options' =&gt; array(
                      'route'    =&gt; '/city[/:action][/:oid]',
                      'constraints' =&gt; array(
                          'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*',
                      ),
                      'defaults' =&gt; array(
                          'controller' =&gt; 'Place\Controller\City',
                          'action'     =&gt; 'index',
                      ),
                  ),
              ),
  
              'country' =&gt; array(
                  'type'    =&gt; 'segment',
                  'options' =&gt; array(
                      'route'    =&gt; '/country[/:action][/:oid]',
                      'constraints' =&gt; array(
                          'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*',
                      ),
                      'defaults' =&gt; array(
                          'controller' =&gt; 'Place\Controller\Country',
                          'action'     =&gt; 'index',
                      ),
                  ),
              ),
  
              'state' =&gt; array(
                  'type'    =&gt; 'segment',
                  'options' =&gt; array(
                      'route'    =&gt; '/state[/:action][/:oid]',
                      'constraints' =&gt; array(
                          'action' =&gt; '[a-zA-Z][a-zA-Z0-9_-]*',
                      ),
                      'defaults' =&gt; array(
                          'controller' =&gt; 'Place\Controller\State',
                          'action'     =&gt; 'index',
                      ),
                  ),
              ),
  
          ),
  ),
  </code></pre>
  
  <p>And this must be my navigation config (actually I located this one in an autoloadable file in /config/autoload/menu.global.php):</p>
  
  <pre><code>return array(
      'navigation' =&gt; array(
          'default' =&gt; array(
              'place' =&gt; array(
                  'label' =&gt; 'Places',
                  'route' =&gt; 'country',
                  'pages' =&gt; array(
                      'country' =&gt; array(
                          'label' =&gt; 'Countries',
                          'route' =&gt; 'country',
                      ),
                      'state' =&gt; array(
                          'label' =&gt; 'States',
                          'route' =&gt; 'state',
                      ),
                      'city' =&gt; array(
                          'label' =&gt; 'Cities',
                          'route' =&gt; 'city',
                      ),
                  ),
              ),
          ),
       ),
  );
  </code></pre>
  
  <p>...And now It works!.</p>