4
I learned that "Whenever you think about data manipulation, think about model. It is responsible for reading and writing data, and also for its validations."
Later another person told me that models is exclusively for data processing more specifically database interface, server connection (or other), update, Insert, delete, select and those things relating to database.
In that case if I have a class called getAllPageContents responsible for:
- Download a certain web page.
- Extract all metatags from this page
- Extract all links and text from this page
And that it returns in an array format. If I want to make this class a model of my MVC I couldn’t? As it is not related to database operations?
In my case this same person recommended me that this logic of the above class should be inside the controller itself or in a separate file but not considered as a model and outside the model folder.
I wonder if this information that the files inside the model folder are unique only for database operations is true, and if it is a Pattern design?
For the examples you gave, it is usually made use of such files as
components
, so you do not bind to the business rule. Themodel
not only limited to BD, you can have a model for generating log in a BD table and at a certain point you choose to create a TXT, but every rule of creation for the log will still be in themodel
. - superficially explaining– Papa Charlie