Skip to content

Commit bdc0b67

Browse files
committed
Optimize getting module object from a mediafile
1 parent 251f77d commit bdc0b67

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,12 @@ To work with Amazon it uses [AWS SDK](https://github.com/aws/aws-sdk-php).
3838

3939
Via composer:
4040

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

4343
or in section **require** of composer.json file set the following:
4444
```
4545
"require": {
46-
"itstructure/yii2-multi-format-uploader": "^2.1.1"
46+
"itstructure/yii2-multi-format-uploader": "^2.1.2"
4747
}
4848
```
4949
and command ```composer install```, if you install yii2 project extensions first,

changelog.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
### CHANGE LOG:
22

3+
**2.1.2 June 12, 2019:**
4+
- Optimize getting module object from a mediafile in **getModule()** function.
5+
36
**2.1.1 June 01, 2019:**
47
- Set ability for collable type of preview options location parameter.
58
Used in **getPreviewOptions()** module method if **is_callable($previewOptions[$location])**.

src/models/Mediafile.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,11 @@ public function getModule(): Module
123123
{
124124

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

127-
$this->_module = /** @scrutinizer ignore-call */ Module::getInstance();
128+
if (empty($this->_module)) {
129+
$this->_module = Module::getInstance();
130+
}
128131
}
129132

130133
return $this->_module;

0 commit comments

Comments
 (0)