What exactly is the Model in a PHP application? [duplicate]

-2

Can a Model Model be used to store the columns of a database table? Or does it just store the methods for the business rule? If it does not store the columns, what part of the application is responsible for storing columns in a table?

    
asked by anonymous 15.07.2018 / 15:43

1 answer

-3

The model is the part that has to have the Data Model logic, regardless if it is a SQL database, NoSQL, Graph etc.

The model should not have business rules, this belongs to the controller layer, in the simplest case it serves as a representation of the data model in the database, so let's say that we have the Products Table containing the Id, Name, Price columns a model of this table would be the ProductsModel class with the Id, Name, Price properties.

In an ideal world you could simply change persistence form (SQL, NoSQL, Graph, TXT File) and this model could work normally - but in general this is not so.     

15.07.2018 / 16:01