title: Use Service Manager Zend Framework 2
body: <p>if I have a service manager in the module Category, such as, can I have read from Category in module Application?</p>
  
  <p>I have done so in Module.php in Application, 'list-category' is located in the module.config.php file of the module Category:</p>
  
  <pre><code>public function onDispatch(MvcEvent $e)
  {
      // get service manager from the application object
      $sm = $e-&gt;getApplication()-&gt;getServiceManager();
      // get categories service
      $categories = $sm-&gt;get('list-category');
      // get view model
      $vm = $e-&gt;getViewModel();
      // store category list in a variable
      $vm-&gt;setVariable('categories', $categories);
  }
  </code></pre>
  
  <p>I have read the service manager by in Module Category in Application.</p>