1
I have a very strong question about what is the best way to create classes to "interact" with the database (in PHP, in this case). For example:
I need very specific validations of each table to be executed before registering something in the database.
So it’s ideal to create classes like: Insert, Update e Delete
? Or should all of these actually be Database class methods? Or would it be better to create each method of this for each model (MVC) of my project?
Anyway, what would be the best way to do this?
Thank you!
There is a lot of opinion of each one. I, for example, think that to use DB in PHP the ideal is not to create any class and use what is already ready. Others may think differently.
– Bacco
About the
Database
, I think thatORM
might bring some light. Usually each model has its own methods that may or may not use BD - there are operations in the model that can generate text log.– Papa Charlie