Conditions | 3 |
Paths | 2 |
Total Lines | 16 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3.0067 |
Changes | 0 |
1 | <?php |
||
32 | 4 | public function run($id) |
|
33 | { |
||
34 | /* @var $model \yii\db\ActiveRecordInterface */ |
||
35 | 4 | $model = $this->findModel($id); |
|
36 | 4 | $request = Yii::$app->getRequest(); |
|
37 | 4 | $this->checkAccess($model, $request->getQueryParams()); |
|
38 | 4 | $model->scenario = $this->scenario; |
|
|
|||
39 | 4 | $model->load( |
|
40 | 4 | $request->getBodyParams() + $this->parseFileAttributes(), |
|
41 | 4 | '' |
|
42 | ); |
||
43 | 4 | if ($model->save() === false && !$model->hasErrors()) { |
|
44 | throw new ServerErrorHttpException('Failed to update the object for unknown reason.'); |
||
45 | } |
||
46 | |||
47 | 4 | return $model; |
|
48 | } |
||
50 |