I have a design issue I need to resolve before starting building my app.
I have a complex data structure which is saved in several small simple tables.
In order to query my DB for a complete comprehensive result I use stored functions.
This is true in majority of cases, and I seldom need only one table data for a certain view.
To make it short I’m having issues understanding what I need exactly in terms of MVC.
I’ll take an example of one view I have. this one view shows results of tests that are ran and their data is stored in a DB server.
The tests track numerous attributes and I use stored procedure to query the data in a way that can tell me what happened in the test.
This view will be controlled by one controller, e.g. resultController which actually won’t do much more then render the view as its data is coming out in a controlled manner from the stored function.
And what about the model? the model only needs to query out the stored function data, it has no data input.
Do I implement a model for this? How do I do that?
What is the recommended methodology in this case ?
By the way, this situation is true through out most of my application, so I’m wondering if this is a good practice or a bad design? I already have a working site that serves me and uses this stored functions and it is working well.
How do I create a model for a stored function? I know how it is done for a table, but not for a function.
Is it okay to say that in my MVC the controller actually serves the view functionality more than it handles the model, if at all.
There is no correlation between the controller and the model other then just get data from it.
The view needs to get data from a couple of stored functions, and translate it to functionality in the view, so in my case let’s say that my view is called “aView” and my controller is called “aController”, but do I need “aModel”?
There is no such model in my DB, this "a" entity is constructed from a couple of stored functions in my DB. So basically "a" is a web app entity and not a DB entity/table.
I would create models that encapsulate the data you need in the views. I would probably use a data source object to create an API for retrieving them, so if it’s ever switched out the API holds true. The models would not be active records however, just behave in a similar fashion by having the appropriate public attributes.