title: Using Zend Framework and Doctrine with independend modular structures
body: <p>I've seen a lot of articles about integrating ZF and Doctrine. There is also a proposal for ZF <a href="http://framework.zend.com/wiki/display/ZFPROP/Zend_Application_Resource_Doctrine+-+Matthew+Lurz" rel="nofollow noreferrer">here</a> but they have always two possible structures. Either they put all models into one top level model directory or they put it into a module related model directory. </p>
  
  <pre>
  application
  |-- Bootstrap.php
  |-- configs
  |-- controllers
  |-- models           - EITHER HERE
  |-- modules
  |   -- examplemodule
  |       |-- controllers
  |       |-- models   - OR HERE
  |       |-- views
  |-- views
  </pre>
  
  <p>For our projects I see problems for either of the two options:<br>
  <strong>1. One directory:</strong> application/models - in a complex system after a short time there will be hundreds of files, over all when you have the table classes two (e.g. User.php and UserTable.php).<br>
  <strong>2. Module based model directories:</strong> application/modules/examplemodule/models - in many cases we use models in multiple modules at the same time. So the "User" is required e.g. in the modules "game", "administration", ...</p>
  
  <p>Is there a way to use some kind of sub directories under the top level directory "models" to get some grouping. It should be completely independent of the module structure.</p>
  
  <pre>
  application
  |-- Bootstrap.php
  ...
  |-- models
  |   -- user
  |       |-- User.php
  |       |-- Friend.php
  |       |-- other user related models
  |   -- game
  |       |-- Game.php
  |       |-- Score.php
  |       |-- ...
  ...
  </pre>
  
  <p>Any solution should support autoloading and the class generation from yaml files.</p>
  
  <p>Any ideas, links or solutions? Thanks!</p>