Skip to content

Commit

Permalink
Optimize getting module object from a mediafile
Browse files Browse the repository at this point in the history
  • Loading branch information
itstructure committed Jun 12, 2019
1 parent 251f77d commit bdc0b67
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -38,12 +38,12 @@ To work with Amazon it uses [AWS SDK](https://github.com/aws/aws-sdk-php).

Via composer:

```composer require itstructure/yii2-multi-format-uploader ^2.1.1```
```composer require itstructure/yii2-multi-format-uploader ^2.1.2```

or in section **require** of composer.json file set the following:
```
"require": {
"itstructure/yii2-multi-format-uploader": "^2.1.1"
"itstructure/yii2-multi-format-uploader": "^2.1.2"
}
```
and command ```composer install```, if you install yii2 project extensions first,
Expand Down
3 changes: 3 additions & 0 deletions changelog.md
@@ -1,5 +1,8 @@
### CHANGE LOG:

**2.1.2 June 12, 2019:**
- Optimize getting module object from a mediafile in **getModule()** function.

**2.1.1 June 01, 2019:**
- Set ability for collable type of preview options location parameter.
Used in **getPreviewOptions()** module method if **is_callable($previewOptions[$location])**.
Expand Down
5 changes: 4 additions & 1 deletion src/models/Mediafile.php
Expand Up @@ -123,8 +123,11 @@ public function getModule(): Module
{

if ($this->_module === null) {
$this->_module = \Yii::$app->getModule(Module::MODULE_NAME);

$this->_module = /** @scrutinizer ignore-call */ Module::getInstance();
if (empty($this->_module)) {
$this->_module = Module::getInstance();
}
}

return $this->_module;
Expand Down

0 comments on commit bdc0b67

Please sign in to comment.