I am new to MVC, but I can already see its advantages and benefits. However, I have a question (maybe easy to answer):
I thought about models and discussed the correct way to structure them. As I see it, there are several options:
1) The models and structure of the table are related from 1 to 1, which means that to a large extent there is a corresponding model for each table. The model class has attributes corresponding to the columns of the table, and has any methods that are necessary (for example, getters and setters) for managing data in the table in any way. This seems like a generic option, and I assume that then I would ask the controller to call the models necessary to perform any business function.
2) Models are more closely related to the business logic operation, and not to data: for example, if at the front end deleting a certain object affects several tables, the model then “models” this behavior and interacts with several tables and performs the necessary function. Then the controller just needs to call a single model for any business behavior. This is less general, since the models are much more closely related ... but it seems to be faster to implement.
3) Something between the first two options. Or maybe I totally don't understand the point.
Hope this makes sense! If I don’t completely miss the point, I tend to think that option (1) is better. Any idea?
Edit: It doesn’t matter that it matters, but I plan to use the Codeigniter PHP MVC framework.
mvcguy123