-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adaptando a instalação do módulo ao padrão de dir Setup/Data/
- Loading branch information
1 parent
bbe35c3
commit 8a39a07
Showing
5 changed files
with
203 additions
and
45 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 was deleted.
Oops, something went wrong.
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,113 @@ | ||
<?php | ||
/** | ||
* Frenet Shipping Gateway | ||
* | ||
* @category Frenet | ||
* | ||
* @author Frenet Gateway <[email protected]> | ||
* @link https://github.com/FrenetGatewaydeFretes/frenet-magento2 | ||
* @link https://www.frenet.com.br | ||
* | ||
* Copyright (c) 2023. | ||
*/ | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace Frenet\Shipping\Setup\Patch\Data; | ||
|
||
use Frenet\Shipping\Model\Catalog\ProductType; | ||
use Frenet\Shipping\Model\Cache\Type\Frenet; | ||
use Magento\Framework\Console\Cli; | ||
use Magento\Framework\Locale\Bundle\DataBundle; | ||
use Magento\Framework\Locale\ResolverInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Framework\Setup\Patch\DataPatchInterface; | ||
use Magento\Framework\Setup\Patch\PatchVersionInterface; | ||
|
||
class FrenetQuotePatchData implements DataPatchInterface, PatchVersionInterface | ||
{ | ||
/** | ||
* @var Frenet | ||
*/ | ||
protected $cacheType; | ||
|
||
/** | ||
* @var AttributeContainer | ||
*/ | ||
protected $attributeContainer; | ||
|
||
/** | ||
* @var EavAttributeInstaller | ||
*/ | ||
private $attributeInstaller; | ||
|
||
/** | ||
* Constructor | ||
* | ||
* @param Frenet $cacheType | ||
* @param AttributeContainer $attributeContainer | ||
* @param EavAttributeInstaller $attributeInstaller | ||
*/ | ||
public function __construct( | ||
Frenet $cacheType, | ||
AttributeContainer $attributeContainer, | ||
EavAttributeInstaller $attributeInstaller | ||
) { | ||
$this->cacheType = $cacheType; | ||
$this->attributeContainer = $attributeContainer; | ||
$this->attributeInstaller = $attributeInstaller; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function apply() | ||
{ | ||
/** | ||
* Run for new installation only. | ||
*/ | ||
$this->configureNewInstallation(); | ||
return Cli::RETURN_SUCCESS; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function getDependencies() | ||
{ | ||
return []; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public static function getVersion() | ||
{ | ||
return '2.4.5'; | ||
} | ||
|
||
/** | ||
* @inheritdoc | ||
*/ | ||
public function getAliases() | ||
{ | ||
return [ "frenetshipping-2.4.5.4" ]; | ||
} | ||
|
||
/** | ||
* Creates the new attributes during the module installation. | ||
*/ | ||
private function configureNewInstallation() | ||
{ | ||
/** | ||
* @var string $code | ||
* @var array $data | ||
*/ | ||
foreach ($this->attributeContainer->getAttributeProperties() as $code => $data) { | ||
$this->attributeInstaller->install($code, (array) $data); | ||
} | ||
|
||
/** Set the Frenet cache type enabled by default when module is installed. */ | ||
$this->cacheType->setEnabled(true); | ||
} | ||
} |
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