Browse Source

Fixes #9204: Fixed Getting Data for Multiple Models using loadMultiple() wrong

tags/2.0.6
Alexander Makarov 9 years ago
parent
commit
be9d85190a
  1. 4
      docs/guide/input-multiple-models.md

4
docs/guide/input-multiple-models.md

@ -36,7 +36,7 @@ class UserController extends Controller
$user->scenario = 'update';
$profile->scenario = 'update';
if (Model::loadMultiple([$user, $profile], Yii::$app->request->post())) {
if ($user->load(Yii::$app->request->post()) && $profile->load(Yii::$app->request->post())) {
if ($user->validate() && $profile->validate()) {
$user->save(false);
$profile->save(false);
@ -53,7 +53,7 @@ class UserController extends Controller
```
In the `update` action, we first load the `$user` and `$profile` models to be updated from the database. We then call
[[yii\base\Model::loadMultiple()]] to populate these two models with the user input. If successful we will validate
[[yii\base\Model::load()]] to populate these two models with the user input. If successful we will validate
the two models and save them. Otherwise we will render the `update` view which has the following content:
```php

Loading…
Cancel
Save