Reputation: 186
I have a simple question. Is it possible to call a controller method from a model? I can't seem to figure it out if it is possible. Should I just be returning something from the model to the controller rather than trying to call a method directly? Thanks, Pat
Upvotes: 1
Views: 4208
Reputation: 2640
Should I just be returning something from the model to the controller rather than trying to call a method directly
Indeed, that's the correct approach. I'm sure there must me some ways to call some methods from the controller, but you shouldn't use them. A model must encapsulate all the logic, business and alike, of the domain problem you are working with. A controller only needs to send and receive messages between models, and back to the views.
Upvotes: 5