We have a huge Zend Framework project, it’s basically a website in 4 different languages and with a fair amount of pages. Usually my application handle 10~15 database tables and probably 5/6 controllers so I place all my model under applications/models.
The problem with that project doing the same would make copy the same models in each modules and probably make a lot of duplicate code and make the maintenance being difficult. I am wondering if it would wise to puts the models under library?
How do you people are doing in such case? some solutions, I am thinking of in my order of preference
- put models and shared code under
/library - make a common module and play with the auto loading to load this classes from any modules
- dirty but possible setup some symbolic links so the files in models come all from the same source … but probably bad
I keep all library code, including models, under /library. IMO, that’s what it’s there for. Then, if you need to share libraries (incl. models) between apps, you can do so with a single symlink or git submodule:
Your local app:
Pulling in external dependencies:
Or:
If you separate models from the library, you’d have two mount points for every dependency.