In general everything that refers to the data should be done in the model, even if indirectly. Any data handling operations should be in the template.
Then the method of entering that data should be placed in the same model. And you can put the detail out of it, as was done in this example.
I imagine the question is whether the controller should make all implementation of the insertion and generally should not.
Each with their own responsibility. The controller should tell you what to do and not how to do it.
I hadn’t paid attention initially, but the line Cliente c = new Cliente();
does not do what you imagine. You are creating another object within the object you are manipulating. This should not be done unless you have a reason to have a new customer within the customer, which is highly unlikely.
It is not this client that should use to record the template, it is the this
.
I think it’s weird create a new client in invalid state.
And I don’t think this DAO is built well. I actually question the use of specific DAO like this, but this is another subject.
That was the question. It helped too much. Thank you.
– Ricardo Alves