-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Set v1.0.7. Added php74 to composer. Added current module version to …
…Configs in Admin. Added installed_module_version
- Loading branch information
Returnless
committed
Mar 2, 2021
1 parent
cfff596
commit 7a55eea
Showing
6 changed files
with
102 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<?php | ||
|
||
namespace Returnless\Connector\Model\Config; | ||
|
||
use Magento\Framework\App\Config\Value; | ||
use Magento\Framework\Model\Context; | ||
use Magento\Framework\Registry; | ||
use Magento\Framework\App\Cache\TypeListInterface; | ||
use Magento\Framework\Model\ResourceModel\AbstractResource; | ||
use Magento\Framework\Data\Collection\AbstractDb; | ||
use Magento\Framework\App\Config\ScopeConfigInterface; | ||
use Magento\Framework\Module\ResourceInterface; | ||
|
||
/** | ||
* Class ModuleVersion | ||
* @package Returnless\Connector\Model\Config | ||
*/ | ||
class ModuleVersion extends Value | ||
{ | ||
/** | ||
* const NAMESPACE_MODULE | ||
*/ | ||
const NAMESPACE_MODULE = 'Returnless_Connector'; | ||
|
||
/** | ||
* @var ResourceInterface | ||
*/ | ||
private $moduleResource; | ||
|
||
/** | ||
* ModuleVersion constructor. | ||
* | ||
* @param Context $context | ||
* @param Registry $registry | ||
* @param ScopeConfigInterface $config | ||
* @param TypeListInterface $cacheTypeList | ||
* @param ResourceInterface $moduleResource | ||
* @param AbstractResource|null $resource | ||
* @param AbstractDb|null $resourceCollection | ||
* @param array $data | ||
*/ | ||
public function __construct( | ||
Context $context, | ||
Registry $registry, | ||
ScopeConfigInterface $config, | ||
TypeListInterface $cacheTypeList, | ||
ResourceInterface $moduleResource, | ||
AbstractResource $resource = null, | ||
AbstractDb $resourceCollection = null, | ||
array $data = [] | ||
) { | ||
$this->moduleResource = $moduleResource; | ||
parent::__construct( | ||
$context, | ||
$registry, | ||
$config, | ||
$cacheTypeList, | ||
$resource, | ||
$resourceCollection, | ||
$data | ||
); | ||
} | ||
|
||
/** | ||
* Inject current installed module version as the config value. | ||
* | ||
* @return void | ||
*/ | ||
public function afterLoad() | ||
{ | ||
$moduleVersion = $this->moduleResource->getDbVersion(self::NAMESPACE_MODULE); | ||
|
||
$this->setValue($moduleVersion); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters