Using Zend Framework and Doctrine with independend modular structures

Posted by stefax on Stack Overflow See other posts from Stack Overflow or by stefax
Published on 2010-01-14T13:21:02Z Indexed on 2010/03/23 13:23 UTC
Read the original article Hit count: 345

Filed under:
|
|
|
|

I've seen a lot of articles about integrating ZF and Doctrine. There is also a proposal for ZF here 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.

application
|-- Bootstrap.php
|-- configs
|-- controllers
|-- models           - EITHER HERE
|-- modules
|   -- examplemodule
|       |-- controllers
|       |-- models   - OR HERE
|       |-- views
|-- views

For our projects I see problems for either of the two options:
1. One directory: 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).
2. Module based model directories: 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", ...

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.

application
|-- Bootstrap.php
...
|-- models
|   -- user
|       |-- User.php
|       |-- Friend.php
|       |-- other user related models
|   -- game
|       |-- Game.php
|       |-- Score.php
|       |-- ...
...

Any solution should support autoloading and the class generation from yaml files.

Any ideas, links or solutions? Thanks!

© Stack Overflow or respective owner

Related posts about zend

Related posts about framework