Conditions | 4 |
Paths | 4 |
Total Lines | 16 |
Lines | 16 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
19 | View Code Duplication | public function init() |
|
20 | { |
||
21 | parent::init(); |
||
22 | if (null === $this->modelName) { |
||
23 | throw new yii\web\ServerErrorHttpException('Model name should be set in controller actions'); |
||
24 | } |
||
25 | |||
26 | if (!is_subclass_of($this->modelName, '\yii\db\ActiveRecord')) { |
||
|
|||
27 | throw new yii\web\ServerErrorHttpException('Model class does not exists'); |
||
28 | } |
||
29 | |||
30 | $this->objectId = BaseObject::getForClass($this->modelName); |
||
31 | if (null === $this->objectId) { |
||
32 | throw new yii\web\ServerErrorHttpException('Object does not exists for model.'); |
||
33 | } |
||
34 | } |
||
35 | |||
66 |