- Member | 20
I have multiple applications. Each of them do its own business but all of them above the same data → model. So the question is, how to have the same model for all of them. (I am using Kdyby\Doctrine)
- most stupid but easiest solution is to have model folder in all projects and if something change, do copy+paste to others. – but the problem is clear, right?
- this is kind of approach I am trying to achieve now – Shift whole applications in modules of one bigger, so I will have one big application, it has one model and many modules which represents earlier applications. Naturally, I want to have independent router, configuration, authenticator etc. for all of them. I managed to have separate configuration for them trough ModuleExtensions and also Routers which are finally combined in a big one (I can live with that for now). But I got stacked with authenticators right now. So I am starting thinking that is not a good approach.
- something different which didn't come up to my mind
So what would you recommend?
- development and production OS: linux
- Apache: 2.4
- PHP: not less than 5.5
- Nette: v2.2.2 – stable version of nette when I started working on those application, I had no need to upgrade since then but I can go higher
- composer: Yes
- git: I am using git for automatic deployment – whatever I push to master branch on github is automatically downloaded and installed on production server without my assistance
- testing: no testing server or some automatic testing environment right now.
- Member | 20
I think, that I just found the 3rd option. And it seems pretty good. Or at least right now. So what do you think about this:
Project 1: domain.tld/project1/<presenter>/<action> Project 2: domain.tld/project2/<presenter>/<action> Project 3: domain.tld/project3/<presenter>/<action>
documentroot/ model/ project1/ app/ config/ presenters/ templates/ log/ temp/ ... project2/ app/ ... project3/ ... bootstraps/ bootstrap-project1.php bootstrap-project2.php bootstrap-project3.php vendor/ www/ index.php
When the request comes, index.php decides which bootstrap should be loaded. And in each bootstrap-*** would be
$configurator->createRobotLoader() ->addDirectory(__DIR__ . '../project***') ->addDirectory(__DIR__ . '../model') ->register();
Do you see any problem which I didn't think of?
- Member | 77
Main question is: What differs between those projects?
Optimal solution from my POV is use same source with different configurations (if possible of course).
Second option is use your model as library used in other projects. If you update model, just do composer update in all applications.
Last edited by mystik (2015-01-31 22:07)