Completed
Push — master ( e1c233...726cec )
by Igor
07:28
created

UpdateAttributesAction   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 21
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 9 1
1
<?php
2
3
namespace app\modules\admin\controllers\common;
4
5
use yii\base\Action;
6
7
class UpdateAttributesAction extends Action
8
{
9
    /**
10
     * @var string $modelName
11
     */
12
    public $modelName;
13
    /**
14
     * @var array $attributes
15
     */
16
    public $attributes;
17
18
    public function run($id)
19
    {
20
        $model = new $this->modelName();
21
22
        $model = $this->controller->loadModel($model, $id);
23
        $model->updateAttributes($this->attributes);
24
25
        return $this->controller->response(true);
26
    }
27
}
28