I have an application that receives several observations from a view and needs to insert this into a table of observations.
I want to know if in this case, controller is who does foreach
and then calls the method in the model to insert one by one or if the model itself is who is responsible for that foreach
.
What would be the ideal with MVC? And how do you always think when using foreach
in MVC applications, ie which layer is responsible for what?
Example:
- In a customer database, I can enter several comments;
- Storing these observations is done in a client_obs table;
-
The process for today's storage is:
foreach($input['observacoes'] as $observacao){ insert cliente_obs($observacao) //exemplo }
-
This process is located in controller