| Conditions | 5 |
| Paths | 4 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 16 | public function afterSave() |
||
| 17 | { |
||
| 18 | /** @var \yii\db\BaseActiveRecord $model */ |
||
| 19 | $model = $this->owner; |
||
| 20 | if (in_array($model->scenario, $this->scenarios)) { |
||
| 21 | if ($this->getUploadedFile() instanceof UploadedFile) { |
||
| 22 | $path = $this->getUploadPath($this->attribute); |
||
| 23 | if (is_string($path) && FileHelper::createDirectory(dirname($path))) { |
||
| 24 | $this->save($this->getUploadedFile(), $path); |
||
| 25 | $this->afterUpload(); |
||
| 26 | } else { |
||
| 27 | throw new InvalidParamException("Directory specified in 'path' attribute doesn't exist or cannot be created."); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | } |
||
| 31 | } |
||
| 32 | } |
||
| 33 |