I am trying to learn MVC structure by developing a simple PHP application, but I don't understand how to structure it - how many models to have, how many controllers etc.
The application should read a DB table which stores rows of messages, each of which has a timestamp, message body, read status, ID etc, then output a list of messages which are searchable and sortable.
I have made a basic proof of concept not using MVC but using a Messages object which has an array of Message objects, but I don't know how to translate this to MVC. How do I get the messages from the DB to my model? Do I have separate models for each message or have one object that holds them all?
I have read a lot of different examples and explanations but have trouble extending the basic concept to a real life use-case.
Aucun commentaire:
Enregistrer un commentaire