79 lines
2.0 KiB
PHP
79 lines
2.0 KiB
PHP
<?php
|
|
/**
|
|
* @package Plumrocket_CookieConsentPro
|
|
* @copyright Copyright (c) 2025 Plumrocket Inc.
|
|
* @license https://plumrocket.com/license End-user License Agreement
|
|
*/
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Plumrocket\CookieConsentPro\Setup\Patch\Data;
|
|
|
|
use Magento\Framework\Setup\ModuleDataSetupInterface;
|
|
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
|
use Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog as ConsentLogResource;
|
|
use Plumrocket\CookieConsentPro\Api\Data\ConsentLogInterface;
|
|
use Plumrocket\CookieConsentPro\Model\Config\Source\ConsentInitiator;
|
|
|
|
/**
|
|
* @since 1.0.1
|
|
*/
|
|
class UpdateLightVersionConsentLogForPro implements DataPatchInterface
|
|
{
|
|
/**
|
|
* @var \Magento\Framework\Setup\ModuleDataSetupInterface
|
|
*/
|
|
private $moduleDataSetup;
|
|
|
|
/**
|
|
* @var \Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog
|
|
*/
|
|
private $consentLogResource;
|
|
|
|
|
|
/**
|
|
* @param \Magento\Framework\Setup\ModuleDataSetupInterface $moduleDataSetup
|
|
* @param \Plumrocket\CookieConsent\Model\ResourceModel\ConsentLog $consentLogResource
|
|
*/
|
|
public function __construct(
|
|
ModuleDataSetupInterface $moduleDataSetup,
|
|
ConsentLogResource $consentLogResource
|
|
) {
|
|
$this->moduleDataSetup = $moduleDataSetup;
|
|
$this->consentLogResource = $consentLogResource;
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function apply()
|
|
{
|
|
$setup = $this->moduleDataSetup;
|
|
$connection = $setup->getConnection();
|
|
|
|
$setup->startSetup();
|
|
$connection->update(
|
|
$this->consentLogResource->getMainTable(),
|
|
[ConsentLogInterface::INITIATED_BY => ConsentInitiator::INITIATOR_CUSTOMER],
|
|
sprintf('%s IS NULL', ConsentLogInterface::INITIATED_BY)
|
|
);
|
|
$setup->endSetup();
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public static function getDependencies()
|
|
{
|
|
return [];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function getAliases()
|
|
{
|
|
return [];
|
|
}
|
|
}
|