MVC: Who should receive data from the form, the controller or the model?

Welcome. Read many articles on MVC but this point remains unclear. Help to understand with MVC.
July 2nd 19 at 18:05
5 answers
July 2nd 19 at 18:08
any request to server it is necessary to take the controller.

In the case of submitting a form, we often use the following sequence:
1 the form Data is sent to the controller
2 controller data is sent to the model for processing (validation)
3 Model returns the processed data or a processing result to the controller
Controller 4 depending on the processing renders an html display for the client
July 2nd 19 at 18:10
My IMHO - takes the controller and transmits the data to the model, where the data are validated
July 2nd 19 at 18:12
The controller Response, transfers the Response form which populates and validates the field.
The shape - model, just not in the store.

Your question is incorrect in your wording.
July 2nd 19 at 18:14
The controller yanked the model, it has sent data. In $model->save() also passed validation. Yii::$app->request->post() Is the data itself. ContactForm is AR.
public function actionContact()
 $model = new ContactForm();
 if ($model->load(Yii::$app->request->post()) && $model->save()) {
 if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
 Yii::$app->session->setFlash('success', 'Thank you for your letter. We will contact you shortly.');
 } else {
 Yii::$app->session->setFlash('error', 'Error sending email.');

 return $this->refresh();
 } else {
 return $this->render('contact', ['model' => $model]);

there is no person on the path of bad code to instruct - Keenan_Turcotte commented on July 2nd 19 at 18:17
: where? - Kendrick_Schu commented on July 2nd 19 at 18:20
July 2nd 19 at 18:16
View lessons on any framework. One day all will become clear.

Find more questions by tags PHPMVC