Where can there be a mistake? print_r ($ game-> getErrors ()); gives Array ()

public function actionUpdate($id) { $game = Game::findOne($id); $screen = Screenshots::find()->where(['game_id' => $id])->All(); if (!isset($game, $screen)) { throw new NotFoundHttpException("The game was not found."); } $game->scenario = 'update'; foreach ($screen as $key) { $key->scenario = 'update'; } if (Model::loadMultiple([$game, $screen], Yii::$app->request->post())) { if ($game->validate() && $screen->validate()) { $game->save(false); foreach ($screen as $key) { $key->save(false); } return $this->redirect(['game/view', 'id' => $id]); } } return $this->render('update', [ 'game' => $game, 'screen' => $screen, ]); } 

    1 answer 1

     $game->save(false); 

    The answer is here. Why put false? Are you sure that you need to put false everywhere and do you understand why it is false at all?

    And why return ?? Just render and that's it.

     $this->render('update', [ 'game' => $game, 'screen' => $screen, ]); 
    • return needed. And yes, the error is that the save with the false flag does not perform validation. - Andrey Kolomensky
    • if the answer is correct, it should be noted. - Artem