Skip to content

Commit

Permalink
INTER-3696 (#250)
Browse files Browse the repository at this point in the history
Co-authored-by: Pavel Bystritsky <[email protected]>
  • Loading branch information
pavel-bystritskyi and p-bystritsky authored May 13, 2024
1 parent d09a2f5 commit b06d1ba
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
64 changes: 64 additions & 0 deletions Setup/Patch/Data/AddLifeElementsValidationValueFixPatch.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

declare(strict_types=1);

namespace Bold\Checkout\Setup\Patch\Data;

use Magento\Framework\Setup\ModuleDataSetupInterface;
use Magento\Framework\Setup\Patch\DataPatchInterface;

/**
* Perform Life elements upgrade - fix.
*/
class AddLifeElementsValidationValueFixPatch implements DataPatchInterface
{
/**
* @var ModuleDataSetupInterface
*/
private $moduleDataSetup;

/**
* @param ModuleDataSetupInterface $moduleDataSetup
*/
public function __construct(
ModuleDataSetupInterface $moduleDataSetup
) {
$this->moduleDataSetup = $moduleDataSetup;
}

/**
* @inheritDoc
*/
public static function getDependencies()
{
return [AddLifeElementsValidationValuePatch::class];
}

/**
* Perform Life elements upgrade - fix.
*
* @return void
*/
public function apply(): void
{
$this->moduleDataSetup->startSetup();

$connection = $this->moduleDataSetup->getConnection();
$connection->delete(
$connection->getTableName('core_config_data'),
[
'path = ?' => 'general',
]
);

$this->moduleDataSetup->endSetup();
}

/**
* @inheritDoc
*/
public function getAliases()
{
return [];
}
}
3 changes: 3 additions & 0 deletions Setup/Patch/Data/AddLifeElementsValidationValuePatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ private function getLifeElements(): array
*/
private function saveLifeElements(array $lifeElements): void
{
if (empty($lifeElements)) {
return;
}
$connection = $this->moduleDataSetup->getConnection();
$table = $connection->getTableName('core_config_data');
$connection->insertOnDuplicate(
Expand Down

0 comments on commit b06d1ba

Please sign in to comment.