45 lines
1.4 KiB
PHP
45 lines
1.4 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace KupShop\EcomailBundle\Resources\upgrade;
|
|
|
|
use Query\Operator;
|
|
|
|
class EcomailUpgrade extends \UpgradeNew
|
|
{
|
|
public function check_EcomailUpgrade(): bool
|
|
{
|
|
return false;
|
|
}
|
|
|
|
public function upgrade_EcomailUpgrade(): void
|
|
{
|
|
$cl = new \ReflectionClass($this);
|
|
$path = str_replace('EcomailUpgrade.php', '', $cl->getFileName());
|
|
$old = json_decode(file_get_contents($path.'upgrade_data.json'), true);
|
|
|
|
$newPath = str_replace('Resources/upgrade/', 'Admin/ConfigurableFeedTemplates/', $path);
|
|
$newBasic = json_decode(file_get_contents($newPath.'Ecomail_orders.json'), true)['row']['template'];
|
|
$newConvert = json_decode(file_get_contents($newPath.'Ecomail_orders_convert_to_czk.json'), true)['row']['template'];
|
|
|
|
sqlQueryBuilder()->update('feeds')
|
|
->directValues(['template' => $newBasic])
|
|
->where(Operator::equals([
|
|
'type' => 'orderConfigurable',
|
|
'template' => $old['template_basic'],
|
|
]))
|
|
->execute();
|
|
|
|
sqlQueryBuilder()->update('feeds')
|
|
->directValues(['template' => $newConvert])
|
|
->where(Operator::equals([
|
|
'type' => 'orderConfigurable',
|
|
'template' => $old['template_convert'],
|
|
]))
|
|
->execute();
|
|
|
|
$this->upgradeOK();
|
|
}
|
|
}
|