In the user model, I describe the registration method. Can I directly interact with the $ _POST` array from this method and write data to the session when the registration is successful?
Or do I need to transfer the form data to the registration method in the controller, and after receiving the registration result, write the data to the session?
And another question: who should deal with data validation - a model or a controller? I validated the data in the model's setters, i.e. Before writing down any property of a user, be it a name or email, the data in the corresponding setter is first checked. It is acceptable?
MVCraises many questions in terms of what should be, but of course it’s worth using as a basis. And now for your questions: Can the model work with apost- no. with cookies - no. In fact, a model is only a set of functions, the task of which isполучитьsome data, process it, and give an answer, so thepostarray is passed as a parameter. and the assignment of cookies is the controller's task. Validate will be engaged in the model. Use in the setter - no, you communicate with the model only through its functions, there is a check, and not specifically with variables. - Manitikyl