title: ZF2 getServiceConfig() from another module
body: <p>So, I have an Admin module which houses all the Controllers such as Users, Usergroups, Products etc. In the <strong>Module.php</strong> there is the getServiceConfig() method which sets all the appropriate database tables for the controllers. This is fine.</p>
  
  <p>My problem is with the Models (User.php and UserTable.php, for ex.). I ideally want these to come from their own independent modules so the Admin module is not completely overwhelmed with files.</p>
  
  <p>When I write Module.php like this:</p>
  
  <pre><code>&lt;?php
  
  namespace Admin;
  
  use User\Model\User;
  use User\Model\UserTable;
  use Zend\Db\ResultSet\ResultSet;
  use Zend\Db\TableGateway\TableGateway;
  use Zend\ModuleManager\Feature\AutoloaderProviderInterface;
  use Zend\Authentication\Adapter\DbTable as DbTableAuthAdapter;
  
  class Module implements AutoloaderProviderInterface {
  
  //Some other methods
  
  public function getServiceConfig() {
      return array(
          'factories' =&gt; array(
              'User\Model\UserTable' =&gt; function($sm) {
          $tableGateway = $sm-&gt;get('UserTableGateway');
          $table = new UserTable($tableGateway);
          return $table;
      },
              'UserTableGateway' =&gt; function($sm) {
          $dbAdapter = $sm-&gt;get('Zend\Db\Adapter\Adapter');
          $resultSetPrototype = new ResultSet();
          $resultSetPrototype-&gt;setArrayObjectPrototype(new User());
          return new TableGateway('user', $dbAdapter, null, $resultSetPrototype);
      },
  </code></pre>
  
  <p>I get a blank page with dies not executing after it tries to initialize <strong>UserTable</strong> and <strong>User</strong> in getServiceConfig method. So, it is definitely a problem with those. It works fine if these classes are in the Admin module.</p>
  
  <p>Ctrl-clicking the classes work so it is finding them. Is there any way to call these from the Admin's <strong>Module.php</strong>? Thanks.</p>