5
I was arguing with a friend of mine about using views (I mean Mysql, not Mysql Pattern MVC).
Hence a doubt arose in the following sense: A Model is used to represent a data structure, and you can read and write data in a table through it. So I could use, in an MVC structure, a model representing a view SQL (so it usually represents a table)?
For example, if I have a view in Mysql, I can represent the same through a model in a framework, like Cakephp, or Laravel, or Django?
I say that because the models generally have methods for writing data. And views are only ways to view data.
If I made a model representing an SQL view, could be violating the principle of model?
You can enter, update, but you can’t delete. That’s amazing! You’ll know how this data is handled internally! About the fact that the application has domain, you mean in the sense of: If I already have the model to work with the data, I don’t need an sql view?
– Wallace Maxters
In theory it does not need because the application is in charge of abstracting the data for you. What I consider valid for use of Views is the concept of Views Materializadas, consolidating the projection of a View on top of physical data. That is, the View comes into being physically.
– Leonel Sanches da Silva