Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 20 |
Changes | 0 |
1 | <?php |
||
37 | public function run($id) |
||
38 | { |
||
39 | /** @var ActiveRecord $model */ |
||
40 | $model = $this->findModel($id); |
||
41 | |||
42 | if ($this->checkAccess) { |
||
43 | call_user_func($this->checkAccess, $this->id, $model); |
||
44 | } |
||
45 | |||
46 | $model->scenario = $this->scenario; |
||
47 | $model->load(Yii::$app->getRequest()->getBodyParams(), ''); |
||
48 | if ($model->save() === false && !$model->hasErrors()) { |
||
49 | throw new ServerErrorHttpException('Failed to update the object for unknown reason.'); |
||
50 | } |
||
51 | |||
52 | return $model; |
||
53 | } |
||
55 |