Now that I have read a huge number of posts, articles, questions and answers on OOP, MVC, and design patterns, I still have questions about how best to build what I want to build.
My little structure is built in MVC style. It uses smarty as a viewer, and I have a class configured as a controller that is called from a URL.
Now that I think I'm lost, is in the model part. I could mix models and classes / objects with many (or with small ones). A.
Anyway, an example. When the goal is to get a list of users who are in my database:
the application is called, for example. "users / list" Then the controller starts a list of functions, which opens an instance of the "user" class and requests this class to retrieve the list from the table. as soon as it returns to the controller, the controller pushes it towards the viewer, assigning a result set (array) to the template and setting the template. Then the user clicks on a row in the table that indicates that the controller launches "user / editing", for example - which in turn creates a form and fills it with user data for editing.
so far so good.
right now I have everything that is combined in one user class, so the class will have the create, getMeAListOfUsers function, update, etc. and properties like hairType and noseSize. But the correct oop design would like me to separate the "user" (with properties such as username, big nose, curly hair) from the "getme user list", which would be more like a "user manager class".
If I implemented a user manager class, what should it look like then? should it be an object (cannot really compare it with the real world) or should it be a class with just public functions so that it more or less looks like a set of functions.
Should it return an array of found records (for example: array([0]=>array("firstname"=>"dirk", "lastname"=>"diggler")) or should it return an array of objects.
All this still confuses me a bit, and I wonder if anyone can give me a little idea of ββhow to make the approach the best way.