title: zf2 way to set up a navigation bar
body: <p>I'm struggling to connect the dots between the ZF1 way of initializing things in a bootstrap, and the ZF2 way of injecting things from a config file (seemingly).</p>
  
  <p>To wit, in ZF1, I had something like this in my boostrap:</p>
  
  <pre><code>protected function _initNavigation()
  {
      $this-&gt;bootstrap('layout');
      $this-&gt;bootstrap('view');
  
      $navigation = new Zend_Navigation();
  
      // ...code to add pages...
  
      $layout = $this-&gt;getResource('layout');
      $view = $layout-&gt;getView();
  
      $view-&gt;navigation($navigation);
  }
  </code></pre>
  
  <p>In ZF2, I'm not even sure what to start looking for, to accomplish something similar.</p>
  
  <p>I've read the posts that refer to:</p>
  
  <pre><code>public function onBootstrap (Event $e)
  {
  }
  </code></pre>
  
  <p>and the way that you can do things like:</p>
  
  <pre><code>$application = $e-&gt;getApplication();
  $services    = $application-&gt;getServiceManager();
  </code></pre>
  
  <p>But, what's the equivalent of:</p>
  
  <pre><code>$layout = $this-&gt;getResource('layout');
  $view = $layout-&gt;getView();
  $view-&gt;navigation($navigation);
  </code></pre>
  
  <p>Would I do this in Module, or is it better done in the config file and injected?  If injected, how?</p>
  
  <p>I've read Rob Allen's tutorial, and have been searching the net for examples of things that go beyond tutorial-level code.  The things that I've found (like other ZF2 modules) have been more oriented toward being working modules (understandably), than being examples through to convey the nuances to others...  Since I can't find much on this topic, I'm assuming that there's some small, fundamental thing I'm missing that -- when I see it -- will have it all make sense.</p>