MVC Design Pattern to Combine Multiple Models for use
Posted
by
roverred
on Programmers
See other posts from Programmers
or by roverred
Published on 2013-11-11T07:23:33Z
Indexed on
2013/11/11
16:15 UTC
Read the original article
Hit count: 180
In my design, I have multiple models and each model has a controller. I need to use all the models to process some operation. Most examples I see are pretty simple with 1 view, 1 controller, and 1 model. How would you get all these models together?
Only ways I can think of are
1) Have a top-level controller which has a reference to every controller. Those controllers will have a getter/setter function for their model.
Does this violate MVC because every controller should have a model?
2) Have an Intermediate class to combine every model into a one model. Then you create a controller for that new super model.
Do you know of any better ideas? Thanks.
© Programmers or respective owner