As per standard MVC
your queries should be executed by the layer Model
. The MVC
is a very popular and widely applied standard these days. It is a standard and can be replaced by others.
However it is strongly recommended that if you follow any pattern, that way if someone else maintains your code you will have a little less difficulty understanding it yourself.
Aligned with MVC
it is interesting to follow other good programming practices, such as: DRY, SOLID and others.
Best practices serve to make our codes more human-readable, thus facilitating maintenance and increasing the project lifecycle.
The big difference in the place where the query is executed is in the project organization.
As for the question of changing the project, I think only you can answer that.
If you are free to restart the project, I recommend you look at the Laravel, which is a php framework that applies MVC
. I recommend it for the wide community membership and ease of finding material.
Voce executes querie in your views ?
– Otto